You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Joe Sunday <su...@csh.rit.edu> on 2008/03/14 17:04:48 UTC
Optional method argument
Sorry if this is obvious, but is there a way to make a method argument
optional from an exported interface?
public interface MyInterface {
@WebMethod(operationName="optionalTest")
public String optionalTest(@WebParam(name="required") String
required,
@WebParam(name="optional") String optional);
}
If a client sends this, it works:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/
" xmlns:csm="http://www.test.com/service">
<soapenv:Header/>
<soapenv:Body>
<csm:optionalTest>
<csm:required>Value1</csm:required>
<csm:optional></csm:optional>
</csm:optionalTest>
</soapenv:Body>
</soapenv:Envelope>
But if they send this (which I want / need to allow for various
reasons), I get a fault:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/
" xmlns:csm="http://www.test.com/service">
<soapenv:Header/>
<soapenv:Body>
<csm:optionalTest>
<csm:required>Value1</csm:required>
</csm:optionalTest>
</soapenv:Body>
</soapenv:Envelope>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance
">
<soap:Body>
<soap:Fault>
<faultcode>soap:Client</faultcode>
<faultstring>Not enough message parts were received for the
operation.</faultstring>
</soap:Fault>
</soap:Body>
</soap:Envelope>
Re: Optional method argument
Posted by Joe Sunday <su...@csh.rit.edu>.
Sorry, I had a brain lapse.. We're migrating a couple applications
from XFire to CXF, and I forgot is one of them that is in progress but
I hadn't gotten cut over yet.
So you're saying this works in CXF unmodified once I port it from XFire?
Thanks,
--Joe
On Mar 14, 2008, at 5:22 PM, Daniel Kulp wrote:
>
> Yes, that should work.
>
> That said, it looks like you are not using CXF. The error message
> shows
> that it's XFire on the server, not CXF. Thus, this issue shoud be
> raised on the XFire lists at codehaus. Or, better yet, migrate your
> application to CXF. :-)
>
> Dan
>
>
> On Friday 14 March 2008, Joe Sunday wrote:
>> Sorry if this is obvious, but is there a way to make a method
>> argument
>> optional from an exported interface?
>>
>> public interface MyInterface {
>> @WebMethod(operationName="optionalTest")
>> public String optionalTest(@WebParam(name="required") String
>> required,
>> @WebParam(name="optional") String optional);
>> }
>>
>> If a client sends this, it works:
>> <soapenv:Envelope
>> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/ "
>> xmlns:csm="http://www.test.com/service">
>> <soapenv:Header/>
>> <soapenv:Body>
>> <csm:optionalTest>
>> <csm:required>Value1</csm:required>
>> <csm:optional></csm:optional>
>> </csm:optionalTest>
>> </soapenv:Body>
>> </soapenv:Envelope>
>>
>> But if they send this (which I want / need to allow for various
>> reasons), I get a fault:
>> <soapenv:Envelope
>> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/ "
>> xmlns:csm="http://www.test.com/service">
>> <soapenv:Header/>
>> <soapenv:Body>
>> <csm:optionalTest>
>> <csm:required>Value1</csm:required>
>> </csm:optionalTest>
>> </soapenv:Body>
>> </soapenv:Envelope>
>>
>> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
>> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance ">
>> <soap:Body>
>> <soap:Fault>
>> <faultcode>soap:Client</faultcode>
>> <faultstring>Not enough message parts were received for the
>> operation.</faultstring>
>> </soap:Fault>
>> </soap:Body>
>> </soap:Envelope>
>
>
>
> --
> J. Daniel Kulp
> Principal Engineer, IONA
> dkulp@apache.org
> http://www.dankulp.com/blog
Re: Optional method argument
Posted by Daniel Kulp <dk...@apache.org>.
Yes, that should work.
That said, it looks like you are not using CXF. The error message shows
that it's XFire on the server, not CXF. Thus, this issue shoud be
raised on the XFire lists at codehaus. Or, better yet, migrate your
application to CXF. :-)
Dan
On Friday 14 March 2008, Joe Sunday wrote:
> Sorry if this is obvious, but is there a way to make a method argument
> optional from an exported interface?
>
> public interface MyInterface {
> @WebMethod(operationName="optionalTest")
> public String optionalTest(@WebParam(name="required") String
> required,
> @WebParam(name="optional") String optional);
> }
>
> If a client sends this, it works:
> <soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/ "
> xmlns:csm="http://www.test.com/service">
> <soapenv:Header/>
> <soapenv:Body>
> <csm:optionalTest>
> <csm:required>Value1</csm:required>
> <csm:optional></csm:optional>
> </csm:optionalTest>
> </soapenv:Body>
> </soapenv:Envelope>
>
> But if they send this (which I want / need to allow for various
> reasons), I get a fault:
> <soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/ "
> xmlns:csm="http://www.test.com/service">
> <soapenv:Header/>
> <soapenv:Body>
> <csm:optionalTest>
> <csm:required>Value1</csm:required>
> </csm:optionalTest>
> </soapenv:Body>
> </soapenv:Envelope>
>
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance ">
> <soap:Body>
> <soap:Fault>
> <faultcode>soap:Client</faultcode>
> <faultstring>Not enough message parts were received for the
> operation.</faultstring>
> </soap:Fault>
> </soap:Body>
> </soap:Envelope>
--
J. Daniel Kulp
Principal Engineer, IONA
dkulp@apache.org
http://www.dankulp.com/blog