PDA

View Full Version : SOAP document style


Belga
03-30-2006, 07:23 AM
Hi
I'd like to use laszlo as a client for my webservice, but i can't figure it out how does it works...
Previously i was generating my webservice with axis through RPC encoded style and i had no problem to make it works with laszlo, but now i'm using jwsdp and it doesn't implement the RPC/encoded style...so i have to make it works with Document Literal style
Any idea ?
Thxs in advance

my webservice ni java:

public String sayHello(String test) {
return test;
}


Here is my laszlo code :

<canvas debug="true" height="530">
<debug x="10" y="40" width="470" height="450" />
<soap name="serv" wsdl="http://127.0.0.1:8080/wsdl/mywsdl.wsdl">

<method event="onload">
Debug.write('soap service loaded.');
</method>

<remotecall funcname="sayHello">
<param value="${ canvas.serv.makedoc(parent.name, s.text) }" />
</remotecall>

<method name="makedoc" args="func, arg">
<![CDATA[
if (func == null) return;
var s = '<' + func + ' xmlns="' + 'http://impl.myservice.services.com/' + '" >' +
'<arg0>' + arg + '</arg0>' +
'</' + func + '>';
Debug.write(s);
return s;
]]>
</method>
</soap>

<view id="search" x="10" y="10" layout="spacing: 5" visible="false">
<view layout="axis: x; spacing: 5">
<edittext id="s" text="services" />
<button text="keyword search" onclick="canvas.serv.sayHello.invoke()" />
</view>
</view>

</canvas>


when invoking the sayHello method i got nothing in return...
when calling it from a java client all works fine

I tried to look up the soap request both form laszlo and my java client , here are the results :


Laszlo

request :
<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>
<ns1:sayHello xmlns="http://impl.myservice.services.com/" xmlns:ns1="http://impl.myservice.services.com/">
<arg0 xmlns="http://impl.myservice.services.com/">test with my laszlo client</arg0>
</ns1:sayHello>
</soapenv:Body>
</soapenv:Envelope>

answer :
<?xml version="1.0" ?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns1="http://impl.myservice.services.com/">
<soapenv:Body>
<ns1:sayHelloResponse></ns1:sayHelloResponse>
</soapenv:Body>
</soapenv:Envelope>


My java client

request:

<?xml version="1.0" ?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns1="http://impl.myservice.services.com/">
<soapenv:Body>
<ns1:sayHello>
<arg0>test with my java client</arg0>
</ns1:sayHello>
</soapenv:Body>
</soapenv:Envelope>

answer :

<?xml version="1.0" ?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns1="http://impl.myservice.services.com/">
<soapenv:Body>
<ns1:sayHelloResponse>
<return>test with my java client</return>
</ns1:sayHelloResponse>
</soapenv:Body>
</soapenv:Envelope>



WSDL for my webservice:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<definitions targetNamespace="http://impl.myservice.services.com/" name="myServiceImplService" xmlns:tns="http://impl.myservice.services.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns="http://schemas.xmlsoap.org/wsdl/">
<types>
<xs:schema version="1.0" targetNamespace="http://impl.myservice.services.com/" xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xs:element name="sayHello" type="ns1:sayHello" xmlns:ns1="http://impl.myservice.services.com/"/>

<xs:complexType name="sayHello">
<xs:sequence>
<xs:element name="arg0" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>

<xs:element name="sayHelloResponse" type="ns2:sayHelloResponse" xmlns:ns2="http://impl.myservice.services.com/"/>

<xs:complexType name="sayHelloResponse">
<xs:sequence>
<xs:element name="return" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
</types>
<message name="sayHello">
<part name="parameters" element="tns:sayHello"/>
</message>
<message name="sayHelloResponse">
<part name="parameters" element="tns:sayHelloResponse"/>
</message>
<portType name="myServiceImpl">
<operation name="sayHello">
<input message="tns:sayHello"/>
<output message="tns:sayHelloResponse"/>
</operation>
</portType>
<binding name="myServiceImplPortBinding" type="tns:myServiceImpl">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name="sayHello">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="myServiceImplService">
<port name="myServiceImplPort" binding="tns:myServiceImplPortBinding">
<soap:address location="http://127.0.0.1:8080/myservice/myservice/"/>
</port>
</service>
</definitions>