facebook

Web Service Client – generated delegate method returns void

  1. MyEclipse IDE
  2.  > 
  3. Java EE Development (EJB, JSP, Struts, XDoclet, etc.)
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #353943 Reply

    neilrichards
    Participant

    … can’t work it out. Wsdl defined like this:

    
    <message name="submitQuotation">
        <part element="tns:submitQuotation" name="parameters"/>
    </message>
    <message name="submitQuotationResponse">
        <part element="tns:submitQuotationResponse" name="parameters"/>
    </message>
    <portType name="QuotationWebServiceDelegate">
        <operation name="submitQuotation">
            <input message="tns:submitQuotation"/>
            <output message="tns:submitQuotationResponse"/>
        </operation>
    </portType>
    

    … but when I create a new web service client from the MyEclipse menu, the resulting delegate class looks like this:

    @WebService(name = "QuotationWebServiceDelegate", targetNamespace = "https://supply.ws.zodiac.mgms.com/")
    public interface QuotationWebServiceDelegate {
    
      /**
       * 
       * @param errorMessage
       * @param resultCode
       * param quotationSubmission
       */
      @WebMethod
      @RequestWrapper(localName = "submitQuotation", targetNamespace = "https://supply.ws.zodiac.mgms.com/", className = "com.mgms.zodiac.ws.supply.SubmitQuotation")
      @ResponseWrapper(localName = "submitQuotationResponse", targetNamespace = "https://supply.ws.zodiac.mgms.com/", className = "com.mgms.zodiac.ws.supply.SubmitQuotationResponse")
      public void submitQuotation(
        @WebParam(name = "quotationSubmission", targetNamespace = "") QuotationSubmission quotationSubmission,
        @WebParam(name = "resultCode", targetNamespace = "", mode = WebParam.Mode.OUT) Holder<Integer> resultCode,
        @WebParam(name = "errorMessage", targetNamespace = "", mode = WebParam.Mode.OUT) Holder<String> errorMessage);
    }
    

    The method returns void, and the properties of SubmitQuotationResponse are included as parameters with mode=OUT. If I want it to just return SubmitQuotationResponse, what do I need to do? The confusing thing is that, apart from the return value being an int and not a custom class, the Calculator tutorial (https://www.genuitec.com/products/myeclipse/learning-center/ws/jax-ws-web-services-clients-tutorial/) example wsdl is structured the same way but creates a method returning an int.

    Clearly my lack of understanding, but would appreciate help in knowing why there’s a difference…

    Many thanks,
    Neil

    #353944 Reply

    neilrichards
    Participant

    Ok …. I’ve resolved the problem by changing the operation name from submitQuotation to submitTheQuotation, after reading this – http://stackoverflow.com/questions/10169072/jax-ws-wsimport-generates-webmethod-with-void-return-same-request-responsewrap.

    My ‘host’ web service from which the wsdl was generated was defined like this:

    @WebMethod(operationName="submitQuotation", action="submitQuotation")
    public @WebResult(name="submitQuotationResponse") SubmitQuotationResponse 
        submitQuotation(@WebParam(name="quotationSubmission") QuotationSubmission quotationSubmission) {
        
    ...
    }
    

    so I explicitly named the operation submitQuotation, but had not seen any documentation that warned against using the same name. Guess it’s a problem.

    Hope that helps someone 🙂

    Neil

    #353952 Reply

    support-swapna
    Moderator

    Neil,

    Glad that you figured it out. Thank you for posting your findings. It will surely help other users. We will check and include it in the documentation.

    Let us know if you see any issues.

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: Web Service Client – generated delegate method returns void

You must be logged in to post in the forum log in