You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "Vespa, Anthony J" <aj...@cbs.com> on 2007/12/04 22:55:17 UTC

Different Order of Elements in Soap Request Breaks CXF based SOAP service

Hello,

I have a service call that takes three parameters - 2 and 3 are the same
type (Long) - if I switch the order of 2 and 3, I get this error:


<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <soap:Fault>
         <faultcode>soap:Server</faultcode>
         <faultstring>Current state not START_ELEMENT</faultstring>
      </soap:Fault>
   </soap:Body>
</soap:Envelope>

Why does this occur?  I have definied the web method to have WebParams
and if I swap around the params of any functions it breaks.  This seems
wrong to me.  

Please advise,

Tony

RE: Different Order of Elements in Soap Request Breaks CXF based SOAP service

Posted by "Vespa, Anthony J" <aj...@cbs.com>.
Hi Dan,

Thank you for the quick response.

This is Java first development.  I'm wondering if the solution further
down the road for us to do some WSDL first; but since I fill in the
webparam as '   @WebParam(name = "messageId")Long messageId)' is there
anything else I could fill in to that annotation to make it a bit more
flexible?

If I were to make the servivce public accessible it seems unacceptable
that people would get sunch an unintuitive meessage - also why would be
done in a list verses a map of key/value pairs representing the
arguments?

Thanks,

Tony

-----Original Message-----
From: Daniel Kulp [mailto:dkulp@apache.org] 
Sent: Tuesday, December 04, 2007 5:07 PM
To: cxf-user@incubator.apache.org
Cc: Vespa, Anthony J
Subject: Re: Different Order of Elements in Soap Request Breaks CXF
based SOAP service


Tony,

Is this a "java first" case or a "wsdl first" case?

For a java first case, this definitely makes sense.  We generate 
the "contract" from the interface and the ordering DOES matter.   Per 
JAX-WS spec, we generate a <sequence> from the method parameters and the

sequence dictates that the information MUST come in that specific order.

Thus, if you change the order of the param, you change the contract.

wsdl first might be a bit more forgiving as long as the @WebParam 
annotation for each param is fully filled in.  We take each element in 
the sequence and try and find the right parameter index based on the 
qnames defined from the WebParam annotations.   Thus, you can move 
things around a bit since the wsdl is the contract, not the SEI 
interface.


Dan



On Tuesday 04 December 2007, Vespa, Anthony J wrote:
> I have a service call that takes three parameters - 2 and 3 are the
> same type (Long) - if I switch the order of 2 and 3, I get this error:
>
>
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>    <soap:Body>
>       <soap:Fault>
>          <faultcode>soap:Server</faultcode>
>          <faultstring>Current state not START_ELEMENT</faultstring>
>       </soap:Fault>
>    </soap:Body>
> </soap:Envelope>
>
> Why does this occur?  I have definied the web method to have WebParams
> and if I swap around the params of any functions it breaks.  This
> seems wrong to me.
>
> Please advise,
>
> Tony



-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog

Re: Different Order of Elements in Soap Request Breaks CXF based SOAP service

Posted by Daniel Kulp <dk...@apache.org>.
Tony,

Is this a "java first" case or a "wsdl first" case?

For a java first case, this definitely makes sense.  We generate 
the "contract" from the interface and the ordering DOES matter.   Per 
JAX-WS spec, we generate a <sequence> from the method parameters and the 
sequence dictates that the information MUST come in that specific order.   
Thus, if you change the order of the param, you change the contract.

wsdl first might be a bit more forgiving as long as the @WebParam 
annotation for each param is fully filled in.  We take each element in 
the sequence and try and find the right parameter index based on the 
qnames defined from the WebParam annotations.   Thus, you can move 
things around a bit since the wsdl is the contract, not the SEI 
interface.


Dan



On Tuesday 04 December 2007, Vespa, Anthony J wrote:
> I have a service call that takes three parameters - 2 and 3 are the
> same type (Long) - if I switch the order of 2 and 3, I get this error:
>
>
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>    <soap:Body>
>       <soap:Fault>
>          <faultcode>soap:Server</faultcode>
>          <faultstring>Current state not START_ELEMENT</faultstring>
>       </soap:Fault>
>    </soap:Body>
> </soap:Envelope>
>
> Why does this occur?  I have definied the web method to have WebParams
> and if I swap around the params of any functions it breaks.  This
> seems wrong to me.
>
> Please advise,
>
> Tony



-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog