views:

112

answers:

2

Hello!

I'm using Apache axis2 and more specifically, the wsdl2java tool to generate the stubs for a web service and create a client, given the wsdl file.

When I try to generate stub classes for a paypal web service (its wsdl file is here) axis won't generate stubs for both the bindings included to the wsdl but just for the second one (PayPalAPIAASoapBinding)

Has anybody worked on this wsdl with apache's wsdl2java tool before?

A: 

apon,
I used Eclipse and created a new Web Service Client project and pointed to the URL you mentioned. I think i was able to create both the stubs. Can you please try creating stubs from Eclipse IDE once?

navr
Eclipse indeed creates stubs for both bindings but just when Apache axis (and not Apache axis2) is selected as Web service runtime.However for my program the stubs must be created dynamically and that's why I can't use eclipse...
apon
A: 

I've been struggling with this, too.

Short answer:
Append "-pn PayPalAPI" to your Axis2 command.

Long answer:
Take a look at following lines of the PayPal WSDL:

   <wsdl:service name="PayPalAPIInterfaceService">
  <wsdl:port name="PayPalAPI" binding="ns:PayPalAPISoapBinding">
     <wsdlsoap:address location="https://api.sandbox.paypal.com/2.0/"/&gt;
  </wsdl:port>
  <wsdl:port name="PayPalAPIAA" binding="ns:PayPalAPIAASoapBinding">
     <wsdlsoap:address location="https://api-aa.sandbox.paypal.com/2.0/"/&gt;
  </wsdl:port>

Obviously, the WSDL specifies 1 service with 2 ports. Our problem is that Axis2 only creates the stub for the second port, "PayPalAPIAA" but not for the port "PayPalAPI".

Now, take a look at the Axis 2 command line option reference (http://ws.apache.org/axis2/tools/1_2/CodegenToolReference.html#cmdref), specifically, at the description of the option "-pn":

"Specifies the port name to be code generated. If the port name is not specified, then the first port (of the selected service) will be picked."

Thus, specifying "-pn PayPalAPI" does the trick.

Stefan Asseg