axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From VinceK <ckang...@hotmail.com>
Subject Re: [Axis2] How to use AXIS2 Client with AXIS1 Server
Date Thu, 22 Feb 2007 03:39:53 GMT

How would I fix this?
Is my wsdd setup wrong?


Ajith Ranabahu wrote:
> 
> Hi,
> I see the problem now. If you look at your WSDL you'll see that the schema
> 
>  <wsdl:types>
>  <schema elementFormDefault="qualified"
> targetNamespace="http://webservice.ran.com/generated"
> xmlns="http://www.w3.org/2001/XMLSchema">
>   <element name="in" type="xsd:string"/>
>   <element name="getTestReturn" type="xsd:string"/>
>  </schema>
>  </wsdl:types>
> 
> the name of the return element name is getTestReturn. The server
> returns a wrong message !
> 
> 
> Ajith
> 
> 
> On 2/21/07, VinceK <ckang777@hotmail.com> wrote:
>>
>> Thanks for the tip.
>> I did what you said and got this :
>>
>> I'm sending :
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <soapenv:Envelope
>> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
>> <soapenv:Header></soapenv:Header>
>> <soapenv:Body>
>> <ns1:in xmlns:ns1="http://webservice.ran.com/generated">Hello</ns1:in>
>> </soapenv:Body>
>> </soapenv:Envelope>
>>
>>
>> AND receiving :
>>
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <soapenv:Envelope
>> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
>> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>> <soapenv:Body>
>> <inReturn xmlns="http://webservice.ran.com/generated">world</inReturn>
>> </soapenv:Body>
>> </soapenv:Envelope>
>>
>> The error message was
>> java.lang.RuntimeException: Unexpected subelement inReturn
>>
>>
>>
>>
>>
>> Ajith Ranabahu wrote:
>> >
>> > Hi,
>> > when you create the stub you can optionally pass in the URL. The
>> > easiest way to get this is to look at the default constructor for the
>> > generated stub.
>> > Take that URL (say "http://127.0.0.1:8080/axis2/services/123")  and
>> > change the host part to point to your tcpmon listner port (Say for
>> > this case URL would be "http://127.0.0.1:9090/axis2/services/123").
>> > Next when you instantiate the stub pass that URL [instead of saying
>> > new MyServiceStub() now say new
>> > MyServiceStub("http://127.0.0.1:9090/axis2/services/123") ]
>> >
>> > On 2/21/07, VinceK <ckang777@hotmail.com> wrote:
>> >>
>> >> How do you foward the calls to the listener port?
>> >>
>> >> Ajith Ranabahu wrote:
>> >> >
>> >> > Hi,
>> >> > Change the port to a free port in your computer (say 9090) and start
>> >> > the listener. Make sure you put the correct port for your server in
>> >> > 'act as a listener ' box.
>> >> > Then forward the calls to the listner port (9090 in this case)
>> >> > More info at http://ws.apache.org/commons/tcpmon/tcpmontutorial.html
>> >> >
>> >> > Ajith
>> >> >
>> >> > On 2/21/07, VinceK <ckang777@hotmail.com> wrote:
>> >> >>
>> >> >> I've tried the TCPMon but it give me a Address already in use:
>> >> JVM_Bind
>> >> >> error.
>> >> >> Listen Port : 8080   Host: 127.0.0.1    Port:8080
>> >> >>
>> >> >>
>> >> >>
>> >> >> Ajith Ranabahu wrote:
>> >> >> >
>> >> >> > Hi,
>> >> >> > Would you be able to monitor the messages using TCPMon[1]
? The
>> most
>> >> >> > probable cause would be the server returning a wrong message
>> >> >> >
>> >> >> > Ajith
>> >> >> >
>> >> >> > [1]http://ws.apache.org/commons/tcpmon/
>> >> >> >
>> >> >> > On 2/21/07, VinceK <ckang777@hotmail.com> wrote:
>> >> >> >>
>> >> >> >> I've changed the service-config.wsdd file
>> >> >> >> <service name="TestWebService" provider="java:RPC">
>> >> >> >> to
>> >> >> >> <service name="TestWebService" style="document" use="literal">
>> >> >> >>
>> >> >> >> This is the wsdl file i got from TestWebService?wsdl
>> >> >> >>
>> >> >> >> <?xml version="1.0" encoding="UTF-8"?>
>> >> >> >> <wsdl:definitions
>> >> >> targetNamespace="http://webservice.ran.com/generated"
>> >> >> >> xmlns:apachesoap="http://xml.apache.org/xml-soap"
>> >> >> >> xmlns:impl="http://webservice.ran.com/generated"
>> >> >> >> xmlns:intf="http://webservice.ran.com/generated"
>> >> >> >> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
>> >> >> >> xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
>> >> >> >> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>> >> >> >> <!--WSDL created by Apache Axis version: 1.3
>> >> >> >> Built on Oct 05, 2005 (05:23:37 EDT)-->
>> >> >> >>  <wsdl:types>
>> >> >> >>   <schema elementFormDefault="qualified"
>> >> >> >> targetNamespace="http://webservice.ran.com/generated"
>> >> >> >> xmlns="http://www.w3.org/2001/XMLSchema">
>> >> >> >>    <element name="in" type="xsd:string"/>
>> >> >> >>    <element name="getTestReturn" type="xsd:string"/>
>> >> >> >>   </schema>
>> >> >> >>  </wsdl:types>
>> >> >> >>
>> >> >> >>    <wsdl:message name="getTestResponse">
>> >> >> >>
>> >> >> >>       <wsdl:part element="impl:getTestReturn"
>> >> name="getTestReturn"/>
>> >> >> >>
>> >> >> >>    </wsdl:message>
>> >> >> >>
>> >> >> >>    <wsdl:message name="getTestRequest">
>> >> >> >>
>> >> >> >>       <wsdl:part element="impl:in" name="in"/>
>> >> >> >>
>> >> >> >>    </wsdl:message>
>> >> >> >>
>> >> >> >>    <wsdl:portType name="TestWebService">
>> >> >> >>
>> >> >> >>       <wsdl:operation name="getTest" parameterOrder="in">
>> >> >> >>
>> >> >> >>          <wsdl:input message="impl:getTestRequest"
>> >> >> >> name="getTestRequest"/>
>> >> >> >>
>> >> >> >>          <wsdl:output message="impl:getTestResponse"
>> >> >> >> name="getTestResponse"/>
>> >> >> >>
>> >> >> >>       </wsdl:operation>
>> >> >> >>
>> >> >> >>    </wsdl:portType>
>> >> >> >>
>> >> >> >>    <wsdl:binding name="TestWebServiceSoapBinding"
>> >> >> >> type="impl:TestWebService">
>> >> >> >>
>> >> >> >>       <wsdlsoap:binding style="document"
>> >> >> >> transport="http://schemas.xmlsoap.org/soap/http"/>
>> >> >> >>
>> >> >> >>       <wsdl:operation name="getTest">
>> >> >> >>
>> >> >> >>          <wsdlsoap:operation soapAction=""/>
>> >> >> >>
>> >> >> >>          <wsdl:input name="getTestRequest">
>> >> >> >>
>> >> >> >>             <wsdlsoap:body use="literal"/>
>> >> >> >>
>> >> >> >>          </wsdl:input>
>> >> >> >>
>> >> >> >>          <wsdl:output name="getTestResponse">
>> >> >> >>
>> >> >> >>             <wsdlsoap:body use="literal"/>
>> >> >> >>
>> >> >> >>          </wsdl:output>
>> >> >> >>
>> >> >> >>       </wsdl:operation>
>> >> >> >>
>> >> >> >>    </wsdl:binding>
>> >> >> >>
>> >> >> >>    <wsdl:service name="TestWebServiceService">
>> >> >> >>
>> >> >> >>       <wsdl:port binding="impl:TestWebServiceSoapBinding"
>> >> >> >> name="TestWebService">
>> >> >> >>
>> >> >> >>          <wsdlsoap:address
>> >> >> >>
>> location="http://localhost:8080/starws/services/TestWebService"/>
>> >> >> >>
>> >> >> >>       </wsdl:port>
>> >> >> >>
>> >> >> >>    </wsdl:service>
>> >> >> >>
>> >> >> >> </wsdl:definitions>
>> >> >> >>
>> >> >> >>
>> >> >> >> With this wsdl file I've generated the java code with
AXIS2
>> >> WSDL2java
>> >> >> >> with
>> >> >> >> options -d adb
>> >> >> >> This created two java files
>> >> TestWebServiceServiceCallbackHandler.java
>> >> >> and
>> >> >> >> TestWebServiceServiceStub.java
>> >> >> >> I use the stub in my client side :
>> >> >> >>
>> >> >> >> String ep =
>> "http://localhost:8080/starws/services/TestWebService";
>> >> >> >> TestWebServiceServiceStub stub = new
>> TestWebServiceServiceStub(ep);
>> >> >> >> HttpTransportProperties.Authenticator authenticator =
new
>> >> >> >> HttpTransportProperties.Authenticator();
>> >> >> >> authenticator.setPreemptiveAuthentication(true);
>> >> >> >> authenticator.setAuthSchemes(Arrays.asList(new
>> >> >> >> String[]{HttpTransportProperties.Authenticator.BASIC}));
>> >> >> >> authenticator.setUsername(username);
>> >> >> >> authenticator.setPassword(password);
>> >> >> >>
>> >> >>
>> >>
>> stub._getServiceClient().getOptions().setProperty(HTTPConstants.AUTHENTICATE,
>> >> >> >> authenticator);
>> >> >> >> In in = new In();
>> >> >> >> in.setIn("Hello");
>> >> >> >> GetTestReturn testReturn= stub.getTest(in);
>> >> >> >> String v = testReturn.getGetTestReturn();
>> >> >> >>
>> >> >> >> I am able to call the service but when it returns it causes
this
>> >> error
>> >> >> :
>> >> >> >> java.lang.RuntimeException: Unexpected subelement inReturn
>> >> >> >> Do you know what i'm doing wrong? Please help!
>> >> >> >> Thanks
>> >> >> >>
>> >> >> >>
>> >> >> >> Ajith Ranabahu wrote:
>> >> >> >> >
>> >> >> >> > Hi,
>> >> >> >> > I guess the more useful would be the WSDL file ,
specifically
>> the
>> >> >> part
>> >> >> >> > on bindings. I have a ffeeling what you have is a
rpc encoded
>> >> >> service
>> >> >> >> > which Axis2 would not cater for.
>> >> >> >> >
>> >> >> >> > Ajith
>> >> >> >> >
>> >> >> >> > On 2/21/07, VinceK <ckang777@hotmail.com> wrote:
>> >> >> >> >>
>> >> >> >> >> I'm having trouble trying to use the services
that I've
>> >> previously
>> >> >> >> made
>> >> >> >> >> with
>> >> >> >> >> AXIS 1.3.
>> >> >> >> >> This service worked perfectly with AXIS1 client
but I want to
>> >> use
>> >> >> >> AXIS2
>> >> >> >> >> client.
>> >> >> >> >>
>> >> >> >> >> This is my server-config.wsdd file.
>> >> >> >> >>
>> >> >> >> >> <?xml version="1.0" encoding="UTF-8"?>
>> >> >> >> >> <deployment
>> >> >> >> >>   xmlns="http://xml.apache.org/axis/wsdd/"
>> >> >> >> >>  
>> xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
>> >> >> >> >>
>> >> >> >> >>   <handler name="auth"
>> >> >> type="java:com.starws.webservice.AuthHandler">
>> >> >> >> >>   <parameter name="timeout" value="500"/>
>> >> >> >> >>   </handler>
>> >> >> >> >>
>> >> >> >> >>   <service name="TestWebService" provider="java:RPC"
>
>> >> >> >> >>         <requestFlow>
>> >> >> >> >>         <handler type="auth"/>
>> >> >> >> >>         </requestFlow>
>> >> >> >> >>
>> >> >> >> >> <namespace>http://webservice.ran.com/generated</namespace>
>> >> >> >> >>         <parameter name="className"
>> >> >> >> >> value="com.starws.webservice.server.TestWebService"/>
>> >> >> >> >>         <parameter name="allowedMethods" value="getTest"/>
>> >> >> >> >>   </service>
>> >> >> >> >>
>> >> >> >> >>   <transport name="http">
>> >> >> >> >>     <requestFlow>
>> >> >> >> >>       <handler
>> >> >> type="java:org.apache.axis.handlers.http.URLMapper"/>
>> >> >> >> >>     </requestFlow>
>> >> >> >> >>   </transport>
>> >> >> >> >> </deployment>
>> >> >> >> >>
>> >> >> >> >> How would I accomplish this?
>> >> >> >> >> THank you.
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >> --
>> >> >> >> >> View this message in context:
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> http://www.nabble.com/How-to-use-AXIS2-Client-with-AXIS1-Server-tf3269002.html#a9088202
>> >> >> >> >> Sent from the Axis - User mailing list archive
at Nabble.com.
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >>
>> >> >>
>> ---------------------------------------------------------------------
>> >> >> >> >> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> >> >> >> >> For additional commands, e-mail: axis-user-help@ws.apache.org
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >
>> >> >> >> >
>> >> >> >> > --
>> >> >> >> > Ajith Ranabahu
>> >> >> >> >
>> >> >> >> >
>> >> >>
>> ---------------------------------------------------------------------
>> >> >> >> > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> >> >> >> > For additional commands, e-mail: axis-user-help@ws.apache.org
>> >> >> >> >
>> >> >> >> >
>> >> >> >> >
>> >> >> >>
>> >> >> >> --
>> >> >> >> View this message in context:
>> >> >> >>
>> >> >>
>> >>
>> http://www.nabble.com/How-to-use-AXIS2-Client-with-AXIS1-Server-tf3269002.html#a9089338
>> >> >> >> Sent from the Axis - User mailing list archive at Nabble.com.
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> ---------------------------------------------------------------------
>> >> >> >> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> >> >> >> For additional commands, e-mail: axis-user-help@ws.apache.org
>> >> >> >>
>> >> >> >>
>> >> >> >
>> >> >> >
>> >> >> > --
>> >> >> > Ajith Ranabahu
>> >> >> >
>> >> >> >
>> >> ---------------------------------------------------------------------
>> >> >> > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> >> >> > For additional commands, e-mail: axis-user-help@ws.apache.org
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >>
>> >> >> --
>> >> >> View this message in context:
>> >> >>
>> >>
>> http://www.nabble.com/How-to-use-AXIS2-Client-with-AXIS1-Server-tf3269002.html#a9091631
>> >> >> Sent from the Axis - User mailing list archive at Nabble.com.
>> >> >>
>> >> >>
>> >> >>
>> ---------------------------------------------------------------------
>> >> >> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> >> >> For additional commands, e-mail: axis-user-help@ws.apache.org
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >> > --
>> >> > Ajith Ranabahu
>> >> >
>> >> >
>> ---------------------------------------------------------------------
>> >> > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> >> > For additional commands, e-mail: axis-user-help@ws.apache.org
>> >> >
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/How-to-use-AXIS2-Client-with-AXIS1-Server-tf3269002.html#a9093205
>> >> Sent from the Axis - User mailing list archive at Nabble.com.
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> >> For additional commands, e-mail: axis-user-help@ws.apache.org
>> >>
>> >>
>> >
>> >
>> > --
>> > Ajith Ranabahu
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> > For additional commands, e-mail: axis-user-help@ws.apache.org
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/How-to-use-AXIS2-Client-with-AXIS1-Server-tf3269002.html#a9093621
>> Sent from the Axis - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> For additional commands, e-mail: axis-user-help@ws.apache.org
>>
>>
> 
> 
> -- 
> Ajith Ranabahu
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-use-AXIS2-Client-with-AXIS1-Server-tf3269002.html#a9093920
Sent from the Axis - User mailing list archive at Nabble.com.


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


Mime
View raw message