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

prefix in soap header

P: n/a
Hi,
I'm trying to call a java web service and i need some help in creating
a custom SOAP header in c#.

I need to access to a Web service that implements authorization policy,
by using a session token to be passed in the SOAP header.

The header should be as the following:

<env:Header>
<cc:sessionContext
xmlns:cc="http://myServer/XMLSchemas/security2.0/">
<ticket>14419812551330193201239823092</ticket>
</cc:sessionContext>
</env:Header>

I tried to create a custom AuthorizationSOAPHeader class to represent
the header, but I was not able to define the right tagprefix "cc" for
the XML root element (sessionContext) and its namespace attribute
(cc="http://myServer/XMLSchemas/security2.0/"). I also tried to
manually add the namespace attribute, by overriding the WriteXml method
provided by the IXmlSerializable interface in the
AuthorizationSOAPHeader class, but it was not possible to correctly set
the tag name to "cc:sessionContext", as the ":" character was encoded.

I had to define a custom header class because it isn't defined in the
wsdl because the soap call is intercepted by a proxy service which
inspects the header of the request in order to see if the caller can be
authenticated; then, if the user is authenticated, the request is
routed to the demanded web service. If the sessionContext node doesn't
have the cc prefix as described above, the request is rejected.

Is there a way to set the tag prefix for the XMLRootElement of the
header class( by overriding the WriteXml provided by the
IXmlSerializable interface ) avoiding the encoding of the colon mark?
Or the only possible solution is to implement a SOAP extension?

Thank you for any answer.

Sep 20 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"Kevin Eldridge" <ke**********@yahoo.itwrote in message
news:11**********************@i3g2000cwc.googlegro ups.com...
Hi,
I'm trying to call a java web service and i need some help in creating
a custom SOAP header in c#.

I need to access to a Web service that implements authorization policy,
by using a session token to be passed in the SOAP header.

The header should be as the following:

<env:Header>
<cc:sessionContext
xmlns:cc="http://myServer/XMLSchemas/security2.0/">
<ticket>14419812551330193201239823092</ticket>
</cc:sessionContext>
</env:Header>

I tried to create a custom AuthorizationSOAPHeader class to represent
the header, but I was not able to define the right tagprefix "cc" for
the XML root element (sessionContext) and its namespace attribute
(cc="http://myServer/XMLSchemas/security2.0/"). I also tried to
manually add the namespace attribute, by overriding the WriteXml method
provided by the IXmlSerializable interface in the
AuthorizationSOAPHeader class, but it was not possible to correctly set
the tag name to "cc:sessionContext", as the ":" character was encoded.

I had to define a custom header class because it isn't defined in the
wsdl because the soap call is intercepted by a proxy service which
inspects the header of the request in order to see if the caller can be
authenticated; then, if the user is authenticated, the request is
routed to the demanded web service. If the sessionContext node doesn't
have the cc prefix as described above, the request is rejected.

Is there a way to set the tag prefix for the XMLRootElement of the
header class( by overriding the WriteXml provided by the
IXmlSerializable interface ) avoiding the encoding of the colon mark?
Or the only possible solution is to implement a SOAP extension?
The prefix isn't an issue, or rather, it had better not be an issue. If this
proxy requires a particular prefix, then it is badly broken.

What's required is for you to get the correct namespace associated with the
element. Then, as long as the prefix generated by .net references the
namespace, this should be acceptable to the proxy.

Also, I've only been actively developing web services for a couple of years,
but I have _never_ heard of proxies adding headers which are not defined in
the WSDL. Any headers MUST be defined in the WSDL, whether or not the server
is the entity which processes them.

If anyone has ever heard of such a thing, could you please point me to a
standard which says that this is legal?

John
Sep 20 '06 #2

P: n/a
Hi,
I'm trying to call a java web service and i need some help in creating
a custom SOAP header in c#.

I need to access to a Web service that implements authorization policy,
by using a session token to be passed in the SOAP header.

The header should be as the following:

<env:Header>
<cc:sessionContext
xmlns:cc="http://myServer/XMLSchemas/security2.0/">
<ticket>14419812551330193201239823092</ticket>
</cc:sessionContext>
</env:Header>

I tried to create a custom AuthorizationSOAPHeader class to represent
the header, but I was not able to define the right tagprefix "cc" for
the XML root element (sessionContext) and its namespace attribute
(cc="http://myServer/XMLSchemas/security2.0/"). I also tried to
manually add the namespace attribute, by overriding the WriteXml method
provided by the IXmlSerializable interface in the
AuthorizationSOAPHeader class, but it was not possible to correctly set
the tag name to "cc:sessionContext", as the ":" character was encoded.

I had to define a custom header class because it isn't defined in the
wsdl because the soap call is intercepted by a proxy service which
inspects the header of the request in order to see if the caller can be
authenticated; then, if the user is authenticated, the request is
routed to the demanded web service. If the sessionContext node doesn't
have the cc prefix as described above, the request is rejected.

Is there a way to set the tag prefix for the XMLRootElement of the
header class( by overriding the WriteXml provided by the
IXmlSerializable interface ) avoiding the encoding of the colon mark?
Or the only possible solution is to implement a SOAP extension?

Thank you for any answer.
It is not uncommon to create a SoapHeader which is not defined in the WSDL. That is the reason why the UnknownSoapHeader class exists in .NET. Combine this with the mustUnderstand instance variables and you have a mechanism of processing/creating SoapHeaders that are not defined in the WSDL.

BizTalk Utilities - Frustration free BizTalk Adapters
http://www.topxml.com/biztalkutilities
Jan 17 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.