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 Tamas Hauer <ta...@cern.ch> on 2003/05/23 12:23:34 UTC
document/literal
Hi,
I am new to the list and in fact am far from being a SOAP guru. I
need to convert some webservices from rpc/enc to doc/lit and need a
little help.
This is how I naively would proceed on the client side:
--------
String endpoint = "http://localhost:8081/axis/services/TestLiteral";
QName qOperation = new QName( "axis/services/TestLiteral", "echo" );
Call call = (Call)
ServiceFactory.newInstance().createService(null).createCall();
call.setTargetEndpointAddress( endpoint );
call.setOperationName( qOperation );
call.setOperationStyle("document");
call.setOperationUse("literal");
call.addParameter("s", XMLType.XSD_STRING, ParameterMode.IN);
call.invoke( new String[] { "hello" } );
--------
I thought that setOperationStyle and setOperationUse would be enough
to switch but this does not seem to work. In fact I am surprised that
"echo" which I set the OperationName to does not even appear in the
soap message. Am I being overly stupid? Does setOperationName has
any effect in the doc/lit case? Should I instead do:
call.addParameter("echo", XMLType.XSD_STRING, ParameterMode.IN);
????
Any hints would be greatly appreciated.
Thanks,
Tamas
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions
targetNamespace="http://localhost:8080/axis/services/TestLiteral"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:impl="http://localhost:8080/axis/services/TestLiteral"
xmlns:intf="http://localhost:8080/axis/services/TestLiteral"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"><wsdl:types><schema
targetNamespace="" xmlns="http://www.w3.org/2001/XMLSchema"><import
namespace="http://schemas.xmlsoap.org/soap/encoding/"/><element
name="mystring" type="xsd:string"/><element name="echoReturn"
type="xsd:string"/></schema></wsdl:types>
<wsdl:message name="echoRequest">
<wsdl:part element="mystring" name="mystring"/>
</wsdl:message>
<wsdl:message name="echoResponse">
<wsdl:part element="echoReturn" name="echoReturn"/>
</wsdl:message>
<wsdl:portType name="Server">
<wsdl:operation name="echo" parameterOrder="mystring">
<wsdl:input message="impl:echoRequest" name="echoRequest"/>
<wsdl:output message="impl:echoResponse" name="echoResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="TestLiteralSoapBinding" type="impl:Server">
<wsdlsoap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="echo">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="echoRequest">
<wsdlsoap:body
namespace="http://localhost:8080/axis/services/TestLiteral"
use="literal"/>
</wsdl:input>
<wsdl:output name="echoResponse">
<wsdlsoap:body
namespace="http://localhost:8080/axis/services/TestLiteral"
use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="ServerService">
<wsdl:port binding="impl:TestLiteralSoapBinding" name="TestLiteral">
<wsdlsoap:address
location="http://localhost:8080/axis/services/TestLiteral"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
--
-------------------------------------------------------------------
-- Tamas Hauer ETT Division, CERN
Tamas.Hauer@cern.ch Geneve 23 Switzerland 1211
http://cern.ch/Tamas.Hauer Tel:(41)-227672342 Fax:(41)-227678930