NetBeans Forums
| View previous topic :: View next topic |
| Author |
Message |
zohare
Joined: 13 Oct 2008 Posts: 11
|
Posted: Tue Nov 18, 2008 1:56 pm Post subject: Something's wrong with client code generation for web services by netbeans 6??? |
|
|
Hi,
I have bad experience with the generated code for web service client in netbeans 6.1. I wonder if its something I'm not doing right, so here's how I reproduce it again, and again...
I don't think it's related to Netbeans though but to some of the axis/wsdl2java tools being used.
1. Create a new WSDL from scratch having a single string parameter, returning a string parameter. (see wsdl below)
2. Create an Axis2 web service from the WSDL
3. Create client for the web service
As can be seen below there are two problems with the generated code:
1. It made the operation void, although it is not
2. It made the first parameter a Holder, although should have been String.
The generated client code:
try { // Call Web Service Operation
org.netbeans.j2ee.wsdl.samplewsdl.SampleWSDLService service = new org.netbeans.j2ee.wsdl.samplewsdl.SampleWSDLService();
org.netbeans.j2ee.wsdl.samplewsdl.SampleWSDLPortType port = service.getSampleWSDLPort();
// TODO initialize WS operation arguments here
javax.xml.ws.Holder<java.lang.String> part1 = new javax.xml.ws.Holder<java.lang.String>();
port.sampleWSDLOperation(part1);
} catch (Exception ex) {
// TODO handle custom exceptions here
}
The WSDL:
<?xml version="1.0" encoding="UTF-8"?>
<definitions name="SampleWSDL" targetNamespace="http://j2ee.netbeans.org/wsdl/SampleWSDL"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://j2ee.netbeans.org/wsdl/SampleWSDL" xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
<types/>
<message name="SampleWSDLOperationRequest">
<part name="part1" type="xsd:string"/>
</message>
<message name="SampleWSDLOperationResponse">
<part name="part1" type="xsd:string"/>
</message>
<portType name="SampleWSDLPortType">
<operation name="SampleWSDLOperation">
<input name="input1" message="tns:SampleWSDLOperationRequest"/>
<output name="output1" message="tns:SampleWSDLOperationResponse"/>
</operation>
</portType>
<binding name="SampleWSDLBinding" type="tns:SampleWSDLPortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="SampleWSDLOperation">
<soap:operation/>
<input name="input1">
<soap:body use="literal" namespace="http://j2ee.netbeans.org/wsdl/SampleWSDL"/>
</input>
<output name="output1">
<soap:body use="literal" namespace="http://j2ee.netbeans.org/wsdl/SampleWSDL"/>
</output>
</operation>
</binding>
<service name="SampleWSDLService">
<port name="SampleWSDLPort" binding="tns:SampleWSDLBinding">
<soap:address location="http://localhost:${HttpDefaultPort}/SampleWSDLService/SampleWSDLPort"/>
</port>
</service>
<plnk:partnerLinkType name="SampleWSDL">
<plnk:role name="SampleWSDLPortTypeRole" portType="tns:SampleWSDLPortType"/>
</plnk:partnerLinkType>
</definitions>
Any idea what could cause that?
Thanks,
Zohar |
|
| Back to top |
|
 |
zohare
Joined: 13 Oct 2008 Posts: 11
|
Posted: Fri Nov 21, 2008 9:33 am Post subject: Change part names from the defaults (at least one of them, so the names will be distinct) |
|
|
Amazingly enough - the reason was that I didn't change the part names in the wsdl from the given defaults: I left it part1 for the input and part1 for the output - it's not so much about leaving the defaults as much as it is about the input and the output having the same name. When changing the part1 in the input to "input" and the part1 in the output to "output" it all works fine.
Thank God. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|