By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,916 Members | 1,286 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,916 IT Pros & Developers. It's quick & easy.

Why does my web services client generate SOAP with blank namespace?

P: n/a
I'm using Visual Studio 2005/C# to build a web client. The web server
is something I've written in a different framework, which does not
support generating wsdl, so I have hand-built a wsdl file, then
created my proxy class by running wsdl.exe. The problem is that the
SOAP message that the client generates contains an empty namespace for
the parameters in my message, instead of the namespace I intended it
to have. I am guessing it is some sort of problem in my wsdl, could
any of you wsdl/.NET experts take a look and see if you can identify
what I have done wrong?

First of all, here is my wsdl file:

--------------START OF WSDL-------------------
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s="http://
www.w3.org/2001/XMLSchema" xmlns:http="http://schemas.xmlsoap.org/wsdl/
http/" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:xtml="http://
www.foobar.com/schemas/common" xmlns:cnf="urn:com.foo.bar"
targetNamespace="urn:com.foo.bar">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://
www.foobar.com/schemas/common">
<s:element name="TrxnID">
<s:simpleType>
<s:restriction base="s:string"/>
</s:simpleType>
</s:element>
<s:element name="src-sessionID">
<s:simpleType>
<s:restriction base="s:string"/>
</s:simpleType>
</s:element>
<s:element name="dst-sessionID">
<s:simpleType>
<s:restriction base="s:string"/>
</s:simpleType>
</s:element>
</s:schema>
<s:schema elementFormDefault="qualified"
targetNamespace="urn:com.foo.bar">
<s:simpleType name="tStatus">
<s:restriction base="s:string"/>
</s:simpleType>
<s:simpleType name="tPhoneNumber">
<s:restriction base="s:string"/>
</s:simpleType>
</s:schema>
</wsdl:types>
<wsdl:message name="RequestHeader">
<wsdl:part name="TrxnID" element="xtml:TrxnID"/>
<wsdl:part name="dst-sessionID" element="xtml:dst-sessionID"/>
</wsdl:message>
<wsdl:message name="ResponseHeader">
<wsdl:part name="TrxnID" element="xtml:TrxnID"/>
<wsdl:part name="src-sessionID" element="xtml:src-sessionID"/>
</wsdl:message>
<wsdl:message name="OutdialRequest">
<wsdl:part name="callingNumber" type="cnf:tPhoneNumber"/>
<wsdl:part name="calledNumber" type="cnf:tPhoneNumber"/>
<wsdl:part name="passCode" type="s:string"/>
</wsdl:message>
<wsdl:message name="OutdialResponse">
<wsdl:part name="status" type="cnf:tStatus"/>
</wsdl:message>
<wsdl:portType name="ConferencePort">
<wsdl:operation name="OutdialOperation">
<wsdl:input message="cnf:OutdialRequest"/>
<wsdl:output message="cnf:OutdialResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ConferenceSOAPBinding" type="cnf:ConferencePort">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/
http"/>
<wsdl:operation name="OutdialOperation">
<soap:operation soapAction="urn:com.foo.bar"/>
<wsdl:input>
<soap:body use="literal" namespace="urn:com.foo.bar"
wsdl:required="true"/>
<soap:header message="cnf:RequestHeader" part="TrxnID"
use="literal"/>
<soap:header message="cnf:RequestHeader" part="dst-sessionID"
use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal" namespace="urn:com.foo.bar"
wsdl:required="true"/>
<soap:header message="cnf:ResponseHeader" part="TrxnID"
use="literal"/>
<soap:header message="cnf:ResponseHeader" part="src-sessionID"
use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="ConferenceService">
<wsdl:port name="Conferencing" binding="cnf:ConferenceSOAPBinding"/>
</wsdl:service>
</wsdl:definitions>
--------------END OF WSDL-------------------

and here is what the generated SOAP message looks like:

-------------START OF GENERATED SOAP REQUEST------------
<?xml version="1.0" encoding="utf-8"?>
<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:Header>
<TrxnID xmlns="http://www.foobar.com/schemas/common">1234</TrxnID>
</soap:Header>
<soap:Body>
<OutdialOperation xmlns="urn:com.foo.bar">
<callingNumber xmlns="">781</callingNumber>
<calledNumber xmlns="">784</calledNumber>
<passCode xmlns="">1234</passCode>
</OutdialOperation>
</soap:Body>
</soap:Envelope>
-------------END OF GENERATED SOAP REQUEST--------------

The problem is that I wanted the parameters in my message, like
'callingNumber', to be associated with the namespace
"urn:com.foo.bar", but as you can see they are associated with a blank
namespace.

Any idea what I am doing wrong? It must be a problem with my wsdl,
right? Can anyone suggest how I modify that wsdl to correctly
indicate that the parameters in my request message above are
associated with that namespace?

Mar 27 '07 #1
Share this Question
Share on Google+
7 Replies


P: n/a

Can anyone help on this? I really don't understand why when I use
style=rpc I am getting namespaces at all in my request parameters, let
alone a blank namespace, i.e.:

<callingNumber xmlns="">

Apr 3 '07 #2

P: n/a
On Apr 3, 8:04 am, "beachdog" <dhor...@pactolus.comwrote:
Can anyone help on this? I really don't understand why when I use
style=rpc I am getting namespaces at all in my request parameters, let
alone a blank namespace, i.e.:

<callingNumber xmlns="">
I'm not sure of the answer to this, as I use document/literal, not
rpc. However, consider using elements for your parts instead of types.
Elements carry a namespace, but I'm not so sure about types.

John

Apr 3 '07 #3

P: n/a
On Apr 3, 5:27 pm, JohnWSaunders...@hotmail.com wrote:
I'm not sure of the answer to this, as I use document/literal, not
rpc. However, consider using elements for your parts instead of types.
Elements carry a namespace, but I'm not so sure about types.
If I try that, then wsdl.exe gives me an error. It looks like with
rpc/literal I can only have types in my parts that are used in a soap
body (??)

c:\temp>wsdl /language:CS conference5.wsdl
Microsoft (R) Web Services Description Language Utility
[Microsoft (R) .NET Framework, Version 2.0.50727.42]
Copyright (C) Microsoft Corporation. All rights reserved.
Warning: This web reference does not conform to WS-I Basic Profile
v1.1.
R2203: An rpc-literal binding in a DESCRIPTION MUST refer, in its
soapbind:body
element(s), only to wsdl:part element(s) that have been defined using
the type attribute.
- Part 'callingNumber' of message 'OutdialRequest' from service
description with targetNamespace='urn:com.pactolus.conferencing'.
- Part 'calledNumber' of message 'OutdialRequest' from service
description with targetNamespace='urn:com.pactolus.conferencing'.
- Part 'passCode' of message 'OutdialRequest' from service
description with targetNamespace='urn:com.pactolus.conferencing'.

For more details on the WS-I Basic Profile v1.1, see the specification
at http://www.ws-i.org/Profiles/BasicProfile-1.1.html.

Warning: one or more operations were skipped.
Warnings were encountered. Review generated source comments for more
details.

Writing file 'c:\temp\ConferenceService.cs'.
Apr 3 '07 #4

P: n/a
Is there any way I can step through the .net serialization code to try
to see why it is attaching a namespace? or any tracing I can turn on
at that level that might help?

Apr 3 '07 #5

P: n/a
"beachdog" <dh*****@pactolus.comwrote in message
news:11**********************@n76g2000hsh.googlegr oups.com...
Is there any way I can step through the .net serialization code to try
to see why it is attaching a namespace? or any tracing I can turn on
at that level that might help?
Stepping through wouldn't show you _why_ it's adding a namespace, it would
only show you _when_ it's adding the namespace.

The short and unsatisfying answer is that the namespace is being included
because .NET thinks it's necessary.

John
Apr 4 '07 #6

P: n/a
On Apr 4, 1:36 pm, "John Saunders" <john.saunders at trizetto.com>
wrote:
The short and unsatisfying answer is that the namespace is being included
because .NET thinks it's necessary.
Well, that is a good point, actually. Something in my wsdl must be
causing it to think this is necessary. And so, I then ask myself:
what is the intent of blank namespace? And I think a blank namespace
causes the active namespace to revert to the default namespace, is
that correct? If so, then .NET believes that the elements in my
message belong to the default namespace. This at least does give me
some avenues for investigating my wsdl...

Apr 5 '07 #7

P: n/a
On Apr 5, 12:58 pm, "beachdog" <dhor...@pactolus.comwrote:
On Apr 4, 1:36 pm, "John Saunders" <john.saunders at trizetto.com>
wrote:
The short and unsatisfying answer is that the namespace is being included
because .NET thinks it's necessary.

Well, that is a good point, actually. Something in my wsdl must be
causing it to think this is necessary. And so, I then ask myself:
what is the intent of blank namespace? And I think a blank namespace
causes the active namespace to revert to the default namespace, is
that correct? If so, then .NET believes that the elements in my
message belong to the default namespace. This at least does give me
some avenues for investigating my wsdl...
A postscript on this. I was never able to figure out why this was
occurring, but I changed my wsdl document to use style=document
instead of style=rpc and now I get the expected behavior. Since the
web service is able to handle the SOAP generated with document style,
that is good enough for me for now.

Apr 21 '07 #8

This discussion thread is closed

Replies have been disabled for this discussion.