[jbossws-users] [JBossWS] Re: Namespace problem: Requested element {http://gaws.mec.com/rta/ws/types}businessDate is not allowed in this position in the sequence.

Douglas Fraser drf at blackchairdvd.com
Mon May 14 21:02:25 EDT 2007


The followup... in case anyone else out there is using JAX-RPC, wstools 
etc...  instead of the fancy new stuff :)

I figured out the problem - the PHP libraries I was using do not process 
the JBoss generated WSDL in the desired way / create a SOAP Message in 
the format desired by JBoss.  I guess it is a standards issue or 
something but I do not know all this well enough (the PHP SOAP Messages 
look fine).  What is happening is that the data within the SOAP body 
needs to have the namespace parts defined like this:

<ns:elementName>  (where ns is defined elsewhere)   or

<ns:elementName xmlns:ns="...">

then the parts within the complexType I was sending should have no 
namespace references

e.g.

<ns:DataStructure xmlns:ns="http://tempuri.org">
   <field1>FieldOne</field1>
   <field2>FieldTwo</field2>
</ns:DataStructure>

any variation on this does not work.    The WSDL uses document/literal, 
parameter style bare.   I think this also applies for style wrapped as well.

the PHP libraries were creating XML with no namespace references or 
every element had a namespace reference.  I could not get the PHP to 
generate the XML in this format automatically - I had to use NuSOAP and 
modified it to figure out what was going on and get it to output the 
desired XML. 


Douglas Fraser wrote:
>
> hi everyone,
>
>   I have JBoss 4.0.5.GA, and am using JBoss WS 1.2.1.  I have created a
> web service (using wstools - not wscompile etc) and the beans, ear etc
> deploy fine.   The WSDL generated from wstools looks ok (to me).  But
> when I try to use a client written in PHP (using the SOAP extension) I
> am getting this all the time:
>
> Caused by: org.jboss.xb.binding.JBossXBRuntimeException: Requested
> element {http://gaws.mec.com/rta/ws/types}businessDate is not allowed in
> this position in the sequence. The next element should be businessDate
>         at
> org.jboss.xb.binding.sunday.unmarshalling.SequenceBinding$1.startElement(SequenceBinding.java:219) 
>
>         at
> org.jboss.xb.binding.sunday.unmarshalling.ModelGroupBinding$Cursor.startElement(ModelGroupBinding.java:159) 
>
>         at
> org.jboss.xb.binding.sunday.unmarshalling.SundayContentHandler.startElement(SundayContentHandler.java:277) 
>
>         at
> org.jboss.xb.binding.parser.sax.SaxJBossXBParser$DelegatingContentHandler.startElement(SaxJBossXBParser.java:323) 
>
>         at
> org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
>
>
> this is the SOAP Request
>
> <?xml version="1.0" encoding="UTF-8"?>
> <SOAP-ENV:Envelope
> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:ns1="http://gaws.mec.com/rta/ws/types">
> <SOAP-ENV:Body>
> <ns1:notifyStatusChange>
> <ns1:businessDate>2007-05-02T12:00:00</ns1:businessDate>
> <ns1:community>testing</ns1:community>
> <ns1:status>OPEN</ns1:status>
> </ns1:notifyStatusChange>
> </SOAP-ENV:Body>
> </SOAP-ENV:Envelope>
>
> As you can see, the fields within the notifyStatusChange structure are
> given a namespace of ns1.   the WSDL is defined as such:
>
>   <schema targetNamespace='http://gaws.mec.com/rta/ws/types'
> xmlns='http://www.w3.org/2001/XMLSchema'
> xmlns:soap11-enc='http://schemas.xmlsoap.org/soap/encoding/'
> xmlns:tns='http://gaws.mec.com/rta/ws/types'
> xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
>    <complexType name='NotifyAccountControl'>
>     <sequence>
>      <element name='account' type='int'/>
>      <element name='accountStatus' nillable='true' type='string'/>
>      <element name='agentNumber' type='int'/>
>      <element name='balance' nillable='true' type='decimal'/>
>
>      <element name='businessDate' nillable='true' type='dateTime'/>
>      <element name='community' nillable='true' type='string'/>
>      <element name='division' nillable='true' type='string'/>
>      <element name='rejectReason' nillable='true' type='string'/>
>      <element name='timeZone' nillable='true' type='string'/>
>      <element name='transactionDate' nillable='true' type='dateTime'/>
>      <element name='transactionType' nillable='true' type='string'/>
>      <element name='window' type='int'/>
>     </sequence>
>    </complexType>
>
> .... and so on
>
> so .... obviously JBoss does not like the subfields being tagged with a
> namespace (as far as I can tell, all my research has been of no help).
> But I can't figure out how to get the PHP client to stop tagging the
> subfields.  I am not an expert on WSDL etc so I am not even sure if the
> PHP client should be doing that.  Should something in the WSDL change
> (as the PHP is working off that as a basis)?
>
> So...  is there anything I can do to the Java code to get it to stop
> being so sensitive?   Is this a valid error?
>
> Or does anyone know what to do in the PHP (I tried using the nusoap
> library and that worked even worse...)?
>
> Or do I just have to write a Java based client for testing as
> anything-but-java is not up to spec like JBossWS is?
> But then the real client (another company using Microsoft .NET) is
> probably going to have problems....
>
> Help!
>
> thanks
> doug
>
>




More information about the jbossws-users mailing list