axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wei Hsu <w...@openharbor.com>
Subject RE: Namespace bug for doc/lit wrapped?
Date Wed, 19 May 2004 17:59:02 GMT
Thanks Jim, what you said makes a lot of sense.  I'm guessing AXIS chose to
adopt the current behavior because it didn't want to potentially create a
global element (inside the user defined/mapped namespace) that may conflict
with existing elements.  Of course the end result is something that works
(by re-declaring a different type mapping for each service), but is rather
unintuitive (at least for this guy).  Anyway, thanks a lot for your help!

-Wei 


-----Original Message-----
From: Jim Murphy [mailto:jmurphy@mindreef.com] 
Sent: Wednesday, May 19, 2004 6:18 AM
To: axis-dev@ws.apache.org
Subject: Re: Namespace bug for doc/lit wrapped?

The SalesOrderID element is defined in the "http//creator" namespace not 
in the "http://xmlns/salesorderEntity" namespace that you think it is.

Check out your element declaration in the "http//creator" XSD:

<element name="createSalesOrder3">
   <complexType>
    <sequence>
     <element name="SalesOrderID" type="tns2:SalesOrderID"/>
    </sequence>
   </complexType>
</element>


This says:

1.  Make an element called {"http//creator"}createSalesOrder3
2.  Make its content model a sequence of elements named 
{"http//creator"}SalesOrderID  **Note the namespace**
3.  The type of the {"http//creator"}SaleesOrderID elements is 
{"http://xmlns/salesorderEntity"}SalesOrderID

With XSD there is a separation between defining and element and 
definging its type.  You have the element defined in "http//creator" and 
the type in "http://xmlns/salesorderEntity"   This is no problem 
assuming you know where everything is. :)

So you can either configure your serializer to expect the element in the 
  {"http//creator"} namespace or write a global element declaration in 
"http://xmlns/salesorderEntity" and reference that from 
createSalesOrder3.  That would look like:

.. somewhere in "http//creator"
<element name="createSalesOrder3">
   <complexType>
    <sequence>
     <element ref="tns2:SalesOrderIDElement"/>
    </sequence>
   </complexType>
</element>

...elsewhere is "http://xmlns/salesorderEntity"...
<element name="SalesOrderIDElement" type="SalesOrderID" />


Regards

Jim Murphy
Mindreef, Inc.






Wei Hsu wrote:

> Hi all,
> 
>  
> 
> I'm running into a namespace issue when I try to use doc/lit wrapped on 
> AXIS 1.2 beta.  I just wanted to confirm if this is a bug or if it is 
> the intended behavior. 
> 
>  
> 
> My java signature is as follows:
> 
>  
> 
> SalesOrderID createSalesOrder3(SalesOrderID soid)
> 
>  
> 
> I have declared a type mapping for SalesOrderID, which maps to 
> SalesOrderID in "http://xmlns/salesorderEntity" namespace.  Then when I 
> use AXIS to generate the wsdl, I get something along the following 
> element created in "http//creator" namespace:
> 
>  
> 
> <element name="createSalesOrder3">
> 
>  <complexType>
> 
>   <sequence>
> 
>    <element name="SalesOrderID" type="tns2:SalesOrderID"/>
> 
>   </sequence>
> 
>  </complexType>
> 
> </element>
> 
>  
> 
> So far so good, or so I thought.  But if I try to actually run wsdl2java 
> and invoke the stubs, the following SOAP message is generated:
> 
>  
> 
> <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>
> 
>   <createSalesOrder3 xmlns="http://creator">
> 
>    <SalesOrderID id="5">12345</SalesOrderID>
> 
>   </createSalesOrder3>
> 
>  </soap:Body>
> 
> </soap:Envelope>
> 
>  
> 
> Here the SalesOrderID element belongs to createSalesOrder3's 
> "http://creator" namespace, instead of "http://xmlns/salesorderEntity" 
> that i expected.  What's worst is that AXIS server cannot find the 
> corresponding method from that message.  What am I doing wrong?  The 
> service works fine if I modify the stubs so that it produces the
following:
> 
>  
> 
> <soapenv:Envelope 
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
> xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi
> 
>  <soapenv:Body>
> 
>   <createSalesOrder3 xmlns="http://creator">
> 
>    <ns1:SalesOrderID 
> xmlns:ns1="http://xmlns/salesorderEntity">12345</ns1:SalesOrderID>
> 
>   </createSalesOrder3>
> 
>  </soapenv:Body>
> 
> </soapenv:Envelope>
> 
>  
> 
> I know .NET also generates the message such that the SalesOrderID is 
> part of the same namespace as createSalesOrder3.  But I can't get AXIS 
> server to accept the default message generated by either the AXIS stubs 
> or .NET stubs.  If this is indeed the expected behavior, does anyone 
> have any suggestions on what I can do then?  I just really want to 
> confirm it either way.
> 
>  
> 
> Thanks for any help you can give!
> 
>  
> 
> -Wei
> 
>  
> 
>  
> 
>  
> 
>  
> 

Mime
View raw message