BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Namespace in SOAPHeader - How to Change

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi WebServices SOAP
View previous topic :: View next topic  
Author Message
John Boren
Guest





PostPosted: Wed Apr 25, 2007 8:13 am    Post subject: Namespace in SOAPHeader - How to Change Reply with quote



After hours of looking through the web to find a remedy, I have given up
because I can't find any solution.

I am having problems changing the Name space prefix within the
SOAPHeader itself.

Here is what the XML Soap looks like currently:
================================
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Header
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:NS1="http://xml.test.org/jxdm/2.1">
<NS1:Credentials>
<Username>OACP1</Username>
<ORINumber>OH12345</ORINumber>
<Password>admin</Password>
</NS1:Credentials>
</SOAP-ENV:Header>
<SOAP-ENV:Body
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<NS2:TestIt xmlns:NS2="http://xml.test.org/jxdm/2.1"/>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

===============

Notice the UserName, ORINumber, Password in the Credentials does NOT
have the Namespace prefix defined. I can't seem to find a way to access
that.

Here is what it should look like:

<NS1:Credentials>
<NS1:Username>OACP1</NS1:Username>
<NS1:ORINumber>OH12345</NS1:ORINumber>
<NS1:Password>admin</NS1:Password>
</NS1:Credentials>

===============

I have tried:
- SoapToObject on the ISOAPHeader
- OnBeforeExecute to change the XML directly, but the change doesn't stick

Using
- Delphi 2006, Update 2

===============

Here is the SoapHeader class generated when I imported the WSDL:

//
************************************************************************ //
// Namespace : http://xml.test.org/jxdm/2.1
//
************************************************************************ //
Credentials = class(TSOAPHeader)
private
FUsername: string;
FORINumber: string;
FPassword: string;
published
property Username: string read FUsername write FUsername;
property ORINumber: string read FORINumber write FORINumber;
property Password: string read FPassword write FPassword;
end;
..
..
..
Initalization
InvRegistry.RegisterHeaderClass(TypeInfo(AdministrativeSoap),
Credentials, 'Credentials','');

============
Here is the original WSDL (part of it):

<s:element name="Credentials" type="tns:Credentials" />
<s:complexType name="Credentials">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="Username"
type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="ORINumber"
type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="Password"
type="s:string" />
</s:sequence>
<s:anyAttribute />
</s:complexType>



============

Does anyone have any advice on how to change the Prefix namespace for
the UserName, ORINumber, and Password?

My only other resort is to build the XML manually and send it using HTTP.

I have to believe there is a way to do this.
Back to top
Jean-Marie Babet
Guest





PostPosted: Sat Apr 28, 2007 2:12 am    Post subject: Re: Namespace in SOAPHeader - How to Change Reply with quote



Hello John,

This might or might not be related but just in case: there was a bug whereby
Delphi would not recognize document services. The importer would miss
emitting the call to register the interface. Something along the lines of:

InvRegistry.RegisterInvokeOptions(TypeInfo(InterfaceName), ioDocument);

The results of that bug is that serialization would use Section-5 encoding
rules... which matches what you're seeing.

Can you point me to the WSDL or confirm whether the importer generated a
call to RegisterInvokeOptions if the service is a document style service?

Thank you,


Bruneau.
Back to top
John Boren
Guest





PostPosted: Sun Apr 29, 2007 4:09 am    Post subject: Re: Namespace in SOAPHeader - How to Change Reply with quote



That was it! I even tried the new WSDL Importer and Soap routines and
re-imported and the resulting .pas file still didn't have this
RegisterInvokeOptions line.

Thanks for the info.

Jean-Marie Babet wrote:
Quote:
Hello John,

This might or might not be related but just in case: there was a bug whereby
Delphi would not recognize document services. The importer would miss
emitting the call to register the interface. Something along the lines of:

InvRegistry.RegisterInvokeOptions(TypeInfo(InterfaceName), ioDocument);

The results of that bug is that serialization would use Section-5 encoding
rules... which matches what you're seeing.

Can you point me to the WSDL or confirm whether the importer generated a
call to RegisterInvokeOptions if the service is a document style service?

Thank you,


Bruneau.

Back to top
Jean-Marie Babet
Guest





PostPosted: Mon Apr 30, 2007 11:39 pm    Post subject: Re: Namespace in SOAPHeader - How to Change Reply with quote

Hello John,

Quote:
That was it!

Thanks for the follow-up post!


Quote:
I even tried the new WSDL Importer and Soap routines and
re-imported and the resulting .pas file still didn't have this
RegisterInvokeOptions line.

What version of the importer were you using? The version number I'm
interested in is the one the importer emits in the file. You'll find
something along the lines of the following in the comments at the top of the
file generated:

// (4/4/2007 12:06:01 PM - - $Rev: 5825 $)

For example, the above is using $Rev: 5825.

Let me know the version as the issue of not properly detecting document
services should be addressed as of HOTFIX10 of BDS2006.

Cheers,

Bruneau.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi WebServices SOAP All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.