| Posted on 2009-10-21 23:34:50-07 by srajan2 |
| Unable to pass parameter to JAVA Web service using SOAP::Lite |
|
I am unable to pass a parameter using SOAP::Lite to call a Java web service.
My java WS wsdl is as below. This is a simple web service tat takes two number as input parameters adds them and returns a result.
Here is my wsdl
--------------------------------------------------------------------------------------------------
<code>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.4-b01-. -->
<definitions targetNamespace="http://ecf/" name="TWSService" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://ecf/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
<types>
<xsd:schema>
<xsd:import namespace="http://ecf/" schemaLocation="TWSService_schema1.xsd"/>
</xsd:schema>
</types>
<message name="addnumbers">
<part name="parameters" element="tns:addnumbers"/>
</message>
<message name="addnumbersResponse">
<part name="parameters" element="tns:addnumbersResponse"/>
</message>
<portType name="TWS">
<operation name="addnumbers">
<input message="tns:addnumbers"/>
<output message="tns:addnumbersResponse"/>
</operation>
</portType>
<binding name="TWSPortBinding" type="tns:TWS">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name="addnumbers">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="TWSService">
<port name="TWSPort" binding="tns:TWSPortBinding">
<soap:address location="http://localhost:8080/WAPP1/TWS"/>
</port>
</service>
</definitions>
------------------------------------------------------------------------------------------------
Here is my XSD file.
------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema version="1.0" targetNamespace="http://ecf/" xmlns:tns="http://ecf/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="addnumbers" type="tns:addnumbers"/>
<xs:element name="addnumbersResponse" type="tns:addnumbersResponse"/>
<xs:complexType name="addnumbers">
<xs:sequence>
<xs:element name="a" type="xs:int"/>
<xs:element name="b" type="xs:int"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="addnumbersResponse">
<xs:sequence>
<xs:element name="return" type="xs:int"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
</code>
--------------------------------------------------------------------------------------------------
I used SOAP::Lite module to call the values.
Here is my call.
my $soap = SOAP::Lite->uri("http://ecf/")->proxy("http://localhost:8080/WAPP1/TWS");
print "Output ----> " . $soap->addnumbers(10,20) . " \n" ;
I get the output as zero. I tried to check the parameters received by the java web service. It is zero for both the parameters. I even tried using SOAP::Data->new(name => 'a', value => 10) but to no avail.
When I use Java as the client, everything is fine.
Any help would be greatly appreciated.
Thanks |
| Direct Responses: 11691 | Write a response |