You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by D <te...@gmail.com> on 2007/03/08 17:17:15 UTC

SWA in WSDL2Java generated client using xmlbeans binding

Hi folks,

I'm no expert in webservices, so I hope I'm not doing something really
stupid.....

I'm using axis2-1.1.1 and generating a webservice client using WSDL2Java
with the following parameters:

                <wsdl2java wsdlFilename="${service.resources.dir}/${
wsdl.name}"
                           output="${generated.src.dir}/${service.name}"
                           packageName="${package.name}"
                           unpackClasses="true"
                           language="java"
                           databindingName="xmlbeans"
                           synconly="true"
                           serverside="true"
                           serverSideInterface="true"
                           generateAllClasses="true"
                           generateservicexml="true"/>


When I use the following binding in my WSDL....

  <wsdl:binding name="MmsSendServiceSOAP" type="tns:MmsSendServicePortType">
    <soap:binding style="document" transport="
http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="SendMms">
      <soap:operation soapAction="urn:mms/SendMms"/>
      <wsdl:input>
        <mime:multipartRelated>
          <mime:part name="parameterpart">
            <soap:body parts="Parameters" use="literal"/>
          </mime:part>
          <mime:part name="attachmentpart">
            <mime:content part="Attachment" type="multipart/*"/>
          </mime:part>
        </mime:multipartRelated>
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal"/>
      </wsdl:output>
      <wsdl:fault name="XError">
        <soap:fault name="XError" use="literal"/>
      </wsdl:fault>
    </wsdl:operation>
  </wsdl:binding>

...WSDL2Java completes successfully but the generated client stub method has
no parameters.

After scouring the web and finding lots of ws tutorials which describe an
identically structured binding for using Soap With Attachments,
I finally found an IBM ws tutorial showing the following binding:

  <wsdl:binding name="MmsSendServiceSOAP" type="tns:MmsSendServicePortType">
    <soap:binding style="document" transport="
http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="SendMms">
      <soap:operation soapAction="urn:mms/SendMms"/>
      <wsdl:input>
        <soap:body use="literal"/>
        <mime:multipartRelated>
          <mime:part name="parameterpart">
            <soap:body parts="Parameters" use="literal"/>
          </mime:part>
          <mime:part name="attachmentpart">
            <mime:content part="Attachment" type="multipart/*"/>
          </mime:part>
        </mime:multipartRelated>
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal"/>
      </wsdl:output>
      <wsdl:fault name="XError">
        <soap:fault name="XError" use="literal"/>
      </wsdl:fault>
    </wsdl:operation>
  </wsdl:binding>

...and with this change WSDL2Java completes successfully and the stub method
has the expected parameters.

Please note the only difference: an additional <soap:body use="literal"/>
inside the <wsdl:input>, but outside the <mime:multipartRelated>


My question: Can anyone please tell me if this is a proper fix?

Another related question....I don't see anywhere in the resulting client
stub class where I can set the MessageContext, or use any other technique to
add attachments to the request....have I missed something?


Many Thanks,
Darren

(P.S. I can provide the full WSDL and xsd files if that helps...I didn't
include them in this post as they're pretty big)

Re: SWA in WSDL2Java generated client using xmlbeans binding

Posted by D <te...@gmail.com>.
Thanks Thilina, I really appreciate your response!

The solution in the blog entry seems workable on the client side, I'm now
attempting something similar on the server side.

Best Regards,
Darren

On 3/9/07, Thilina Gunarathne <cs...@gmail.com> wrote:
>
> >
> >    <wsdl:binding name="MmsSendServiceSOAP"
> > type="tns:MmsSendServicePortType">
> >     <soap:binding style="document"
> > transport="http://schemas.xmlsoap.org/soap/http "/>
> >     <wsdl:operation name="SendMms">
> >       <soap:operation soapAction="urn:mms/SendMms"/>
> >       <wsdl:input>
> >         <soap:body use="literal"/>
> >         <mime:multipartRelated>
> >           <mime:part name="parameterpart">
> >             <soap:body parts="Parameters" use="literal"/>
> >           </mime:part>
> >           <mime:part name="attachmentpart">
> >             <mime:content part="Attachment" type="multipart/*"/>
> >           </mime:part>
> >         </mime:multipartRelated>
> >       </wsdl:input>
> >       <wsdl:output>
> >         <soap:body use="literal"/>
> >       </wsdl:output>
> >       <wsdl:fault name="XError">
> >         <soap:fault name="XError" use="literal"/>
> >       </wsdl:fault>
> >     </wsdl:operation>
> >   </wsdl:binding>
> Axis2 does not support the above binding yet.. :(
> If possible you can try using MTOM...[1]
>
> >
> > ...and with this change WSDL2Java completes successfully and the stub
> method
> > has the expected parameters.
> >
> > Please note the only difference: an additional <soap:body
> use="literal"/>
> > inside the <wsdl:input>, but outside the <mime:multipartRelated>
> >
> >
> > My question: Can anyone please tell me if this is a proper fix?
> >
> > Another related question....I don't see anywhere in the resulting client
> > stub class where I can set the MessageContext, or use any other
> technique to
> > add attachments to the request....have I missed something?
> It's not possible.. It's available only through the OperationClient API..
>
> Have a look at the blog entry titled "Use XMLBean generated objects
> with Axis2" in here [2] to figure out how to data bound only to
> schemas and to use operationClient respectively...
>
> Thilina
> [1] http://ws.apache.org/axis2/1_1_1/mtom-guide.html#25
> [2] http://www.bloglines.com/blog/hemapani/2006_10
>
> >
> >
> > Many Thanks,
> > Darren
> >
> > (P.S. I can provide the full WSDL and xsd files if that helps...I didn't
> > include them in this post as they're pretty big)
> >
>
>
> --
> Thilina Gunarathne
> WSO2, Inc.; http://www.wso2.com/
> Home page: http://webservices.apache.org/~thilina/
> Blog: http://thilinag.blogspot.com/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>

Re: SWA in WSDL2Java generated client using xmlbeans binding

Posted by Thilina Gunarathne <cs...@gmail.com>.
>
>    <wsdl:binding name="MmsSendServiceSOAP"
> type="tns:MmsSendServicePortType">
>     <soap:binding style="document"
> transport="http://schemas.xmlsoap.org/soap/http "/>
>     <wsdl:operation name="SendMms">
>       <soap:operation soapAction="urn:mms/SendMms"/>
>       <wsdl:input>
>         <soap:body use="literal"/>
>         <mime:multipartRelated>
>           <mime:part name="parameterpart">
>             <soap:body parts="Parameters" use="literal"/>
>           </mime:part>
>           <mime:part name="attachmentpart">
>             <mime:content part="Attachment" type="multipart/*"/>
>           </mime:part>
>         </mime:multipartRelated>
>       </wsdl:input>
>       <wsdl:output>
>         <soap:body use="literal"/>
>       </wsdl:output>
>       <wsdl:fault name="XError">
>         <soap:fault name="XError" use="literal"/>
>       </wsdl:fault>
>     </wsdl:operation>
>   </wsdl:binding>
Axis2 does not support the above binding yet.. :(
If possible you can try using MTOM...[1]

>
> ...and with this change WSDL2Java completes successfully and the stub method
> has the expected parameters.
>
> Please note the only difference: an additional <soap:body use="literal"/>
> inside the <wsdl:input>, but outside the <mime:multipartRelated>
>
>
> My question: Can anyone please tell me if this is a proper fix?
>
> Another related question....I don't see anywhere in the resulting client
> stub class where I can set the MessageContext, or use any other technique to
> add attachments to the request....have I missed something?
It's not possible.. It's available only through the OperationClient API..

Have a look at the blog entry titled "Use XMLBean generated objects
with Axis2" in here [2] to figure out how to data bound only to
schemas and to use operationClient respectively...

Thilina
[1] http://ws.apache.org/axis2/1_1_1/mtom-guide.html#25
[2] http://www.bloglines.com/blog/hemapani/2006_10

>
>
> Many Thanks,
> Darren
>
> (P.S. I can provide the full WSDL and xsd files if that helps...I didn't
> include them in this post as they're pretty big)
>


-- 
Thilina Gunarathne
WSO2, Inc.; http://www.wso2.com/
Home page: http://webservices.apache.org/~thilina/
Blog: http://thilinag.blogspot.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org