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 Martin Egholm Nielsen <ma...@egholm-nielsen.dk> on 2005/02/08 10:35:26 UTC
Method without parameter generates faulty client in .NET
Hi there,
I'm generating a wsdl with Axis 1.2rc2 (with parameters --style DOCUMENT
--use LITERAL) for a simple interface with a method with no parameters:
package somepackage;
public interface EmptyArgInterface
{
public int getSomething();
}
Then I import the wsdl as a new webreference in .NET, and that works
without warnings.
However, when I invoke the method #getSomething() the generated SOAP doc
contains no reference to the method:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body />
</soap:Envelope>
I tried with another client framework, as well, and the same empty body
occured.
The wsdl is given below, and as can be seen, there is no <xsd:part />
for the message-element describing the request...
<wsdl:message name="getSomethingRequest">
</wsdl:message>
Does anybody has an idea of why this does not work (in either of the two
independent clients)?
Maybe the wsdl should look different at that point?
Best regards,
Martin Egholm
==== WSDL ====
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://somepackage"
xmlns:impl="http://somepackage" xmlns:intf="http://somepackage"
xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<!--WSDL created by Apache Axis version: 1.2RC2
Built on Nov 16, 2004 (12:19:44 EST)-->
<wsdl:types>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://somepackage" elementFormDefault="qualified">
<element name="getSomethingReturn" type="xsd:int"/>
</schema>
</wsdl:types>
<wsdl:message name="getSomethingResponse">
<wsdl:part name="getSomethingReturn"
element="impl:getSomethingReturn"/>
</wsdl:message>
<wsdl:message name="getSomethingRequest">
</wsdl:message>
<wsdl:portType name="EmptyArgInterface">
<wsdl:operation name="getSomething">
<wsdl:input name="getSomethingRequest"
message="impl:getSomethingRequest"/>
<wsdl:output name="getSomethingResponse"
message="impl:getSomethingResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="BlahSoapBinding" type="impl:EmptyArgInterface">
<wsdlsoap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="getSomething">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="getSomethingRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="getSomethingResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="EmptyArgInterfaceService">
<wsdl:port name="Blah" binding="impl:BlahSoapBinding">
<wsdlsoap:address location="http://localhost/Blah"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Re: Method without parameter generates faulty client in .NET
Posted by Bill Keese <bi...@tech.beacon-it.co.jp>.
Yup. My impression is that most new web services use wrapped/literal in
fact, so I think it's the path of least resistance for interop.
Note that the line in your WSDD file
<service name="InicioSOAP" provider="java:RPC" style="wrapped"
use="literal">
is not visible to the .NET clients. Rather, it affects the way the Axis
server processes requests, and possibly the auto-generation of the WSDL
file, if you are using auto-generation.
Bill
Martin Egholm Nielsen wrote:
>>>> Did you want your soap:Body to contain <getSomething/> ?
>>>
>>> Exactly yes - I actually never considered that the method didn't
>>> appear when using document/literal.
>>> For that I need rpc/encoded or rpc/literal? But the latter is not
>>> supported in .NET right?!
>>
>> You want wrapped/literal. Technically, wrapped/literal is a
>> special-case of document/literal, but let's not worry about that for
>> now.
>
> Oooh... And this is supported by .NET, as well?
>
> > You need to specify wrapped/literal style in your WSDD like this:
>
>> <service name="InicioSOAP" provider="java:RPC" style="wrapped"
>> use="literal">
>> For the wsdl file there are a number of rules too. Mainly, that the
>> schema definition has to correspond to <getSomething/>.
>
> Super!
>
> Thanks Bill,
> Martin
>
>
>
Re: Method without parameter generates faulty client in .NET
Posted by Martin Egholm Nielsen <ma...@egholm-nielsen.dk>.
>>> Did you want your soap:Body to contain <getSomething/> ?
>> Exactly yes - I actually never considered that the method didn't
>> appear when using document/literal.
>> For that I need rpc/encoded or rpc/literal? But the latter is not
>> supported in .NET right?!
> You want wrapped/literal. Technically, wrapped/literal is a
> special-case of document/literal, but let's not worry about that for
> now.
Oooh... And this is supported by .NET, as well?
> You need to specify wrapped/literal style in your WSDD like this:
> <service name="InicioSOAP" provider="java:RPC" style="wrapped"
> use="literal">
> For the wsdl file there are a number of rules too. Mainly, that the
> schema definition has to correspond to <getSomething/>.
Super!
Thanks Bill,
Martin
Re: Method without parameter generates faulty client in .NET
Posted by Bill Keese <bi...@tech.beacon-it.co.jp>.
>> Did you want your soap:Body to contain <getSomething/> ?
>
> Exactly yes - I actually never considered that the method didn't
> appear when using document/literal.
> For that I need rpc/encoded or rpc/literal? But the latter is not
> supported in .NET right?!
You want wrapped/literal. Technically, wrapped/literal is a
special-case of document/literal, but let's not worry about that for
now. You need to specify wrapped/literal style in your WSDD like this:
<service name="InicioSOAP" provider="java:RPC" style="wrapped"
use="literal">
For the wsdl file there are a number of rules too. Mainly, that the
schema definition has to correspond to <getSomething/>.
>
Re: Method without parameter generates faulty client in .NET
Posted by Martin Egholm Nielsen <ma...@egholm-nielsen.dk>.
Hi,
>> I'm generating a wsdl with Axis 1.2rc2 (with parameters --style
>> DOCUMENT --use LITERAL) for a simple interface with a method with no
>> parameters...when I invoke the method #getSomething() the generated
>> SOAP doc contains no reference to the method:
>>
>> <?xml version="1.0" encoding="utf-8"?>
>> <soap:Envelope
>> xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>> <soap:Body />
>> </soap:Envelope>
> Document/Literal never contains the method name within the <soap:Body/>,
> although Wrapped/Literal does. Document/Literal just contains the
> arguments to the method in the <soap:Body/> . In this case there are no
> arguments so the <soap:Body> is empty.
>
> The method (aka operation) is sometimes listed in the envelope (I
> think), and also sometimes listed outside the envelope in the HTTP
> header information. But maybe you want to be using wrapped/literal?
> Did you want your soap:Body to contain <getSomething/> ?
Exactly yes - I actually never considered that the method didn't appear
when using document/literal.
For that I need rpc/encoded or rpc/literal? But the latter is not
supported in .NET right?!
Thanks,
Martin
Re: Method without parameter generates faulty client in .NET
Posted by Bill Keese <bi...@tech.beacon-it.co.jp>.
> I'm generating a wsdl with Axis 1.2rc2 (with parameters --style
> DOCUMENT --use LITERAL) for a simple interface with a method with no
> parameters...when I invoke the method #getSomething() the generated
> SOAP doc contains no reference to the method:
>
> <?xml version="1.0" encoding="utf-8"?>
> <soap:Envelope
> xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> <soap:Body />
> </soap:Envelope>
Document/Literal never contains the method name within the <soap:Body/>,
although Wrapped/Literal does. Document/Literal just contains the
arguments to the method in the <soap:Body/> . In this case there are no
arguments so the <soap:Body> is empty.
The method (aka operation) is sometimes listed in the envelope (I
think), and also sometimes listed outside the envelope in the HTTP
header information. But maybe you want to be using wrapped/literal?
Did you want your soap:Body to contain <getSomething/> ?
Bill