aspose file tools*
The moose likes Web Services and the fly likes Empty Namespace in SOAP (Axis 1.4) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Empty Namespace in SOAP (Axis 1.4)" Watch "Empty Namespace in SOAP (Axis 1.4)" New topic

Empty Namespace in SOAP (Axis 1.4)

Freddy Wong
Ranch Hand

Joined: Sep 11, 2006
Posts: 959

Hi all,

I'm using Axis 1.4 in my project. Below is the fictitious WSDL to illustrate the similar problem that I face.

SOAP request:

I don't know why Axis always generates empty namespace in the request element of the SOAP request above. Actually I am expecting the SOAP request to be like this (without the xmlns="").
SOAP request:

If I expect the SOAP request to be like that, do I need to do in my WSDL?

Thanks in advance.

[ UD: added linebreaks for better readability ]
[ November 07, 2007: Message edited by: Ulf Dittmer ]

SCJP 5.0, SCWCD 1.4, SCBCD 1.3, SCDJWS 1.4
My Blog
Peer Reynders

Joined: Aug 19, 2005
Posts: 2906
Unfortunately your "desired" SOAP request does not comply with the rules for interoperable RPC/literal mode of messaging as specified by WS-I Basic 1.0a which clarifies some ambiguities in SOAP 1.1/ WSDL 1.1.

Basic Profile Version 1.0: 5.6.20 Namespace for Part Accessors

For rpc-literal SOAP messages, WSDL 1.1 is not clear what namespace, if any, the accessor elements for parameters and return value are a part of. Different implementations make different choices, leading to interoperability problems.

R2735 A MESSAGE described with an rpc-literal binding MUST place the part accessor elements for parameters and return value in no namespace.

Settling on one alternative is crucial to achieving interoperability. The Profile places the part accessor elements in no namespace as doing so is simple, covers all cases, and does not lead to logical inconsistency.

So Axis is in effect enforcing this rule by undeclaring the default namespace to ensure that the part element is in no namespace - which is the correct action to take.

You get more control of the content of the SOAP body by going with the Document/literal mode of messaging.
[ November 06, 2007: Message edited by: Peer Reynders ]

"Don't succumb to the false authority of a tool or model. There is no substitute for thinking."
Andy Hunt, Pragmatic Thinking & Learning: Refactor Your Wetware p.41
Peer Reynders

Joined: Aug 19, 2005
Posts: 2906
First convert the WSDL to Document/literal

This leads to the followng Java Interface

and the following Request/Response pairs:

As you will notice the elements corresponding to the operation name have disappeared - this is normal in the document/literal mode of messaging. You are submitting a document- it is up to the service to decide what to do with the document based on its type or content - there is no concept of an operation.

If - for whatever reason - you still need the wrapping operation element you apply the wrapped document/literal convention.

WSDL employing the wrapped document/literal convention.

This leads to the following Java Interface:

and the following Request/Response:

Java client code:
Freddy Wong
Ranch Hand

Joined: Sep 11, 2006
Posts: 959

That's very clear. Thanks a lot, Peer I owe you one.
I agree. Here's the link:
subject: Empty Namespace in SOAP (Axis 1.4)
Similar Threads
AXIS 1.4 Response XML Help-Urgent
Support string array in wsdl
TcpMon in Eclipse
Cannot create service instance, service 'x' not found in wsdl
How to get Servcies,Input output xml formats from WSDL