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 Branko Kaucic <br...@amis.net> on 2005/08/18 02:05:25 UTC
WSDL - duplicate methods
Hi all!
I am completely new to Axis, but... I tried to follow the user guide and to
generate Java files from sample WSDL file Axis2SampleDocLit.wsdl, but
I got duplicate methods in DataBindingSupporter classes.
Also, when I tried my sample (WSDL is attached below) without using any
user defined data types, I got the same problem. What am I doing wrong?
Also (I opened the project in Eclipse) I got some other problems in the
same DrugiServisPortTypemetoda4DatabindingSupporter.
Please, could someone help.
Thanks in advance,
B
--
<?xml version="1.0" encoding="UTF-8"?>
<definitions name="DrugiServis"
targetNamespace="XYZ"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="XYZ"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<types>
</types>
<message name="metoda4">
<part element="xsd:string" name="aVal"/>
</message>
<message name="metoda4Response">
<part element="xsd:string" name="result"/>
</message>
<message name="metoda3"/>
<message name="metoda3Response"/>
<portType name="DrugiServisPortType">
<operation name="metoda4">
<input message="tns:metoda4" name="metoda4"/>
<output message="tns:metoda4Response" name="metoda4Response"/>
</operation>
<operation name="metoda3">
<input message="tns:metoda3" name="metoda3"/>
<output message="tns:metoda3Response" name="metoda3Response"/>
</operation>
</portType>
<binding name="DrugiServisPortBinding"
type="tns:DrugiServisPortType">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="metoda4">
<soap:operation soapAction="metoda4" style="rpc"/>
<input name="metoda4">
<soap:body namespace="XYZ" use="literal"/>
</input>
<output name="metoda4Response">
<soap:body namespace="XYZ" use="literal"/>
</output>
</operation>
<operation name="metoda3">
<soap:operation soapAction="metoda3" style="rpc"/>
<input name="metoda3">
<soap:body namespace="XYZ" use="literal"/>
</input>
<output name="metoda3Response">
<soap:body namespace="XYZ" use="literal"/>
</output>
</operation>
</binding>
<service name="DrugiServis">
<port binding="tns:DrugiServisPortBinding" name="DrugiServisPort">
<soap:address
location="http://localhost/axis2/services/DrugiServis.wsdl"/>
</port>
</service>
</definitions>
--
Re: WSDL - duplicate methods
Posted by Branko Kaucic <br...@amis.net>.
Thanks.
Unfortunatelly :( I tried types insted of elements and the same thing
happened. The same
duplicate methods are also for the sample that you corrected.
Below is the generated file from the corrected file:
--
package test1.databinding;
/**
* Auto generated supporter class for XML beans by the Axis code
generator
*/
public class DrugiServisPortTypemetoda4DatabindingSupporter {
public static org.apache.axis2.om.OMElement
toOM(org.apache.axis2.om.OMElement param){
org.apache.axis2.om.impl.llom.builder.StAXOMBuilder builder
= new org.apache.axis2.om.impl.llom.builder.StAXOMBuilder
(org.apache.axis2.om.OMAbstractFactory.getOMFactory(),new
org.apache.axis2.clientapi.StreamWrapper(param.newXMLStreamReader())) ;
org.apache.axis2.om.OMElement documentElement =
builder.getDocumentElement();
//Building the element is needed to avoid certain stream errors!
documentElement.build();
return documentElement;
}
public static org.apache.axis2.om.OMElement
toOM(org.apache.axis2.om.OMElement param){
org.apache.axis2.om.impl.llom.builder.StAXOMBuilder builder
= new org.apache.axis2.om.impl.llom.builder.StAXOMBuilder
(org.apache.axis2.om.OMAbstractFactory.getOMFactory(),new
org.apache.axis2.clientapi.StreamWrapper(param.newXMLStreamReader())) ;
org.apache.axis2.om.OMElement documentElement =
builder.getDocumentElement();
//Building the element is needed to avoid certain stream errors!
documentElement.build();
return documentElement;
}
public static org.apache.xmlbeans.XmlObject
fromOM(org.apache.axis2.om.OMElement param,
java.lang.Class type){
try{
if (org.apache.axis2.om.OMElement.class.equals(type)){
return
org.apache.axis2.om.OMElement.Factory.parse(param.getXMLStreamReader()) ;
}
if (org.apache.axis2.om.OMElement.class.equals(type)){
return
org.apache.axis2.om.OMElement.Factory.parse(param.getXMLStreamReader()) ;
}
}catch(java.lang.Exception e){
throw new RuntimeException("Data binding error",e);
}
return null;
}
//Generates an empty object for testing
// Caution - need some manual editing to work properly
public static org.apache.xmlbeans.XmlObject
getTestObject(java.lang.Class type){
try{
if (org.apache.axis2.om.OMElement.class.equals(type)){
org.apache.axis2.om.OMElement emptyObject=
org.apache.axis2.om.OMElement.Factory.newInstance();
////////////////////////////////////////////////
// TODO
// Fill in the empty object with necessaey
values. Empty XMLBeans objects do not generate proper events
////////////////////////////////////////////////
return emptyObject;
}
if (org.apache.axis2.om.OMElement.class.equals(type)){
org.apache.axis2.om.OMElement emptyObject=
org.apache.axis2.om.OMElement.Factory.newInstance();
////////////////////////////////////////////////
// TODO
// Fill in the empty object with necessaey
values. Empty XMLBeans objects do not generate proper events
////////////////////////////////////////////////
return emptyObject;
}
}catch(java.lang.Exception e){
throw new RuntimeException("Test object creation
failure",e);
}
return null;
}
}
--
As you can see there are:
1) two methods toOM,
2) duplicated if structures in try-catch inside method fromOM
3) duplicated if structures in try-catch inside method getTestObject
I have generated Java files from WSDL with
makeWSDL2Java -uri DrugiServis.wsdl -ss -sd -o src -p test1
makeWSDL2Java is a bat file that calls
java -cp %AXIS2_CLASSPATH% org.apache.axis2.wsdl.WSDL2Java %1 %2 %3 %4
%5 %6 %7 %8 %9
similar as in bat file in bin directory
Since nobody else is reporting about duplicated methods, I guess it must
be me doing something wrong.
Regards, Branko
Anne Thomas Manes wrote:
>Your WSDL has some errors in it. When using RPC style, your message
>parts must reference types rather than elements. Also Axis doesn't
>support mixed styles, so you have to use either document or RPC.
>
>Here's an updated WSDL:
>
><?xml version="1.0" encoding="UTF-8"?>
><definitions name="DrugiServis"
> targetNamespace="XYZ"
> xmlns="http://schemas.xmlsoap.org/wsdl/"
> xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> xmlns:tns="XYZ"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>
> <types>
> </types>
>
> <message name="metoda4">
> <part type="xsd:string" name="aVal"/>
> </message>
> <message name="metoda4Response">
> <part type="xsd:string" name="result"/>
> </message>
> <message name="metoda3"/>
> <message name="metoda3Response"/>
>
> <portType name="DrugiServisPortType">
> <operation name="metoda4">
> <input message="tns:metoda4" name="metoda4"/>
> <output message="tns:metoda4Response" name="metoda4Response"/>
> </operation>
> <operation name="metoda3">
> <input message="tns:metoda3" name="metoda3"/>
> <output message="tns:metoda3Response" name="metoda3Response"/>
> </operation>
> </portType>
>
> <binding name="DrugiServisPortBinding"
> type="tns:DrugiServisPortType">
> <soap:binding style="rpc"
>transport="http://schemas.xmlsoap.org/soap/http"/>
> <operation name="metoda4">
> <soap:operation soapAction="metoda4" style="rpc"/>
> <input name="metoda4">
> <soap:body namespace="XYZ" use="literal"/>
> </input>
> <output name="metoda4Response">
> <soap:body namespace="XYZ" use="literal"/>
> </output>
> </operation>
> <operation name="metoda3">
> <soap:operation soapAction="metoda3" style="rpc"/>
> <input name="metoda3">
> <soap:body namespace="XYZ" use="literal"/>
> </input>
> <output name="metoda3Response">
> <soap:body namespace="XYZ" use="literal"/>
> </output>
> </operation>
> </binding>
>
> <service name="DrugiServis">
> <port binding="tns:DrugiServisPortBinding" name="DrugiServisPort">
> <soap:address
>location="http://localhost/axis2/services/DrugiServis.wsdl"/>
> </port>
> </service>
>
></definitions>
>
>
>On 8/17/05, Branko Kaucic <br...@amis.net> wrote:
>
>
>>Hi all!
>>
>>I am completely new to Axis, but... I tried to follow the user guide and to
>>generate Java files from sample WSDL file Axis2SampleDocLit.wsdl, but
>>I got duplicate methods in DataBindingSupporter classes.
>>Also, when I tried my sample (WSDL is attached below) without using any
>>user defined data types, I got the same problem. What am I doing wrong?
>>
>>Also (I opened the project in Eclipse) I got some other problems in the
>>same DrugiServisPortTypemetoda4DatabindingSupporter.
>>
>>Please, could someone help.
>>
>>Thanks in advance,
>>B
>>
>>--
>><?xml version="1.0" encoding="UTF-8"?>
>><definitions name="DrugiServis"
>> targetNamespace="XYZ"
>> xmlns="http://schemas.xmlsoap.org/wsdl/"
>> xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
>> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
>> xmlns:tns="XYZ"
>> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>>
>> <types>
>> </types>
>>
>> <message name="metoda4">
>> <part element="xsd:string" name="aVal"/>
>> </message>
>> <message name="metoda4Response">
>> <part element="xsd:string" name="result"/>
>> </message>
>> <message name="metoda3"/>
>> <message name="metoda3Response"/>
>>
>> <portType name="DrugiServisPortType">
>> <operation name="metoda4">
>> <input message="tns:metoda4" name="metoda4"/>
>> <output message="tns:metoda4Response" name="metoda4Response"/>
>> </operation>
>> <operation name="metoda3">
>> <input message="tns:metoda3" name="metoda3"/>
>> <output message="tns:metoda3Response" name="metoda3Response"/>
>> </operation>
>> </portType>
>>
>> <binding name="DrugiServisPortBinding"
>> type="tns:DrugiServisPortType">
>> <soap:binding style="document"
>>transport="http://schemas.xmlsoap.org/soap/http"/>
>> <operation name="metoda4">
>> <soap:operation soapAction="metoda4" style="rpc"/>
>> <input name="metoda4">
>> <soap:body namespace="XYZ" use="literal"/>
>> </input>
>> <output name="metoda4Response">
>> <soap:body namespace="XYZ" use="literal"/>
>> </output>
>> </operation>
>> <operation name="metoda3">
>> <soap:operation soapAction="metoda3" style="rpc"/>
>> <input name="metoda3">
>> <soap:body namespace="XYZ" use="literal"/>
>> </input>
>> <output name="metoda3Response">
>> <soap:body namespace="XYZ" use="literal"/>
>> </output>
>> </operation>
>> </binding>
>>
>> <service name="DrugiServis">
>> <port binding="tns:DrugiServisPortBinding" name="DrugiServisPort">
>> <soap:address
>>location="http://localhost/axis2/services/DrugiServis.wsdl"/>
>> </port>
>> </service>
>>
>></definitions>
>>--
>>
>>
>>
>
>
>
Re: WSDL - duplicate methods
Posted by Anne Thomas Manes <at...@gmail.com>.
Your WSDL has some errors in it. When using RPC style, your message
parts must reference types rather than elements. Also Axis doesn't
support mixed styles, so you have to use either document or RPC.
Here's an updated WSDL:
<?xml version="1.0" encoding="UTF-8"?>
<definitions name="DrugiServis"
targetNamespace="XYZ"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="XYZ"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<types>
</types>
<message name="metoda4">
<part type="xsd:string" name="aVal"/>
</message>
<message name="metoda4Response">
<part type="xsd:string" name="result"/>
</message>
<message name="metoda3"/>
<message name="metoda3Response"/>
<portType name="DrugiServisPortType">
<operation name="metoda4">
<input message="tns:metoda4" name="metoda4"/>
<output message="tns:metoda4Response" name="metoda4Response"/>
</operation>
<operation name="metoda3">
<input message="tns:metoda3" name="metoda3"/>
<output message="tns:metoda3Response" name="metoda3Response"/>
</operation>
</portType>
<binding name="DrugiServisPortBinding"
type="tns:DrugiServisPortType">
<soap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="metoda4">
<soap:operation soapAction="metoda4" style="rpc"/>
<input name="metoda4">
<soap:body namespace="XYZ" use="literal"/>
</input>
<output name="metoda4Response">
<soap:body namespace="XYZ" use="literal"/>
</output>
</operation>
<operation name="metoda3">
<soap:operation soapAction="metoda3" style="rpc"/>
<input name="metoda3">
<soap:body namespace="XYZ" use="literal"/>
</input>
<output name="metoda3Response">
<soap:body namespace="XYZ" use="literal"/>
</output>
</operation>
</binding>
<service name="DrugiServis">
<port binding="tns:DrugiServisPortBinding" name="DrugiServisPort">
<soap:address
location="http://localhost/axis2/services/DrugiServis.wsdl"/>
</port>
</service>
</definitions>
On 8/17/05, Branko Kaucic <br...@amis.net> wrote:
> Hi all!
>
> I am completely new to Axis, but... I tried to follow the user guide and to
> generate Java files from sample WSDL file Axis2SampleDocLit.wsdl, but
> I got duplicate methods in DataBindingSupporter classes.
> Also, when I tried my sample (WSDL is attached below) without using any
> user defined data types, I got the same problem. What am I doing wrong?
>
> Also (I opened the project in Eclipse) I got some other problems in the
> same DrugiServisPortTypemetoda4DatabindingSupporter.
>
> Please, could someone help.
>
> Thanks in advance,
> B
>
> --
> <?xml version="1.0" encoding="UTF-8"?>
> <definitions name="DrugiServis"
> targetNamespace="XYZ"
> xmlns="http://schemas.xmlsoap.org/wsdl/"
> xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> xmlns:tns="XYZ"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>
> <types>
> </types>
>
> <message name="metoda4">
> <part element="xsd:string" name="aVal"/>
> </message>
> <message name="metoda4Response">
> <part element="xsd:string" name="result"/>
> </message>
> <message name="metoda3"/>
> <message name="metoda3Response"/>
>
> <portType name="DrugiServisPortType">
> <operation name="metoda4">
> <input message="tns:metoda4" name="metoda4"/>
> <output message="tns:metoda4Response" name="metoda4Response"/>
> </operation>
> <operation name="metoda3">
> <input message="tns:metoda3" name="metoda3"/>
> <output message="tns:metoda3Response" name="metoda3Response"/>
> </operation>
> </portType>
>
> <binding name="DrugiServisPortBinding"
> type="tns:DrugiServisPortType">
> <soap:binding style="document"
> transport="http://schemas.xmlsoap.org/soap/http"/>
> <operation name="metoda4">
> <soap:operation soapAction="metoda4" style="rpc"/>
> <input name="metoda4">
> <soap:body namespace="XYZ" use="literal"/>
> </input>
> <output name="metoda4Response">
> <soap:body namespace="XYZ" use="literal"/>
> </output>
> </operation>
> <operation name="metoda3">
> <soap:operation soapAction="metoda3" style="rpc"/>
> <input name="metoda3">
> <soap:body namespace="XYZ" use="literal"/>
> </input>
> <output name="metoda3Response">
> <soap:body namespace="XYZ" use="literal"/>
> </output>
> </operation>
> </binding>
>
> <service name="DrugiServis">
> <port binding="tns:DrugiServisPortBinding" name="DrugiServisPort">
> <soap:address
> location="http://localhost/axis2/services/DrugiServis.wsdl"/>
> </port>
> </service>
>
> </definitions>
> --
>