Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4538418
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T14:48:32+00:00 2026-05-21T14:48:32+00:00

Using Glassfish Metro implementation of JAX-WS specification, is it possible to generate SOAP request

  • 0

Using Glassfish Metro implementation of JAX-WS specification, is it possible to generate SOAP request message for specific operation without actually invoking the operation. Something like SOAPUI ability to generate sample SOAP message basing just on WSDL only that I would like to generate it providing parameters for operation.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T14:48:33+00:00Added an answer on May 21, 2026 at 2:48 pm

    OK. I think I’ve got it. It ain’t pretty and it ain’t clean as it uses reflection, bases on Oracle proprietary classes and assumes that you’ve your client side WS part already generated but if you need such functionality as badly as I do with deadline approaching unavoidable like death itself then hear my tale 🙂

    // location of wsdl file provided in URL format
    // ex. file://localhost/C:/wsdl.wsdl for local file
    String wsdlLocation = "wsdlLocation";
    
    try{
        // we're assuming that you've already generated WS client side
        GeneratedService service = new GeneratedService(
            new URL(wsdlLocation),
            new QName("namespaceURI", "localPart"));
    
        GeneratedPort port = service.getGeneratedPort();
    
        SEIStub stub = (SEIStub) Proxy.getInvocationHandler(port);
    
        Field methodHandlersField =
            stub.getClass().getDeclaredField("methodHandlers");
        //hack to make private field accessible
        methodHandlersField.setAccessible(true);
    
        Method operationMethod = null;
        Object args = null;
    
        switch (somethingToTellYouWhatMethodToInvoke){
            case someMethodValue:
                operationMethod = GeneratedPort.class.getMethod(
                    "methodName", classes, of, your, attributes);
                args = new Object[]{attributes, of, your, method};
                break;
            default:
                throw new SomeException("some message");
                break;
        }
    
        MethodHandler handler = ((Map<Method, MethodHandler>) methodHandlersField.
            get(stub)).get(operationMethod);
    
        Method createMessageMethod = handler.getClass().getSuperclass().
            getDeclaredMethod("createRequestMessage", Object[].class);
        //another hack
        createMessageMethod.setAccessible(true);
    
        Message message = (Message) createMessageMethod.invoke(handler, args);
    
        Transformer transformer =
            TransformerFactory.newInstance().newTransformer();
        transformer.setOutputProperty(OutputKeys.INDENT, "yes");
        transformer.setOutputProperty(
            "{http://xml.apache.org/xslt}indent-amount", "2");
        transformer.transform(
            message.readPayloadAsSource(), new StreamResult(System.out));
    } catch (Exception e){
        //lots of things to catch
        e.printStackTrace();
    }
    

    So once again this is very bad solution but until some heavy thinker comes and saves my day with something better or Sun moves classes I need to more friendly package it has to suffice.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Netbeans 6.5 to generate the JAX-WS Metro service and Glassfish 2.1 as
I'm using Glassfish and Toplink together with an MS-SQL-Server, thus sqljdbc4.jar is used for
I am using Glassfish JMS. I am able to add messages to a queue.
We are using Glassfish v2 (9.1_02) at work. Our servers are not set up
I am using Glassfish v2, Hibernate with Annotations+EntityManager and Postgresql 8.4. I am also
I m using glassfish v2 and persistence in a web application. I m calling
I'm using glassfish 2.1.1. I've watched a mysterious http/webservice-call handling. It seams an http
I'm using Glassfish 3 Web profile and can't get http workers to execute concurrently
I'm developing a JSF2 application using Glassfish which contains some EJB's; is there a
I'm trying to compile a webservice through NetBeans 6.7 using Glassfish v3 as the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.