webservice with soap headers

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

webservice with soap headers

Jon Paynter-2
I cant seem to get soap headers to work with webservices.    Using 7.8, and based on the info in docs\Webservices.pdf I created the following workspace snippet:
| client result args arg |
args := OrderedCollection new.
arg := WebServices.Struct new.
arg at: #msg put: String new.
args add: arg.
client := WsdlClient url:  'http:// internal webserver .... ?WSDL'.
(client headerFor: #userId) value: 'myUserid'.
result := client executeSelector: #isServiceAlive args: args.
result.

im attempting to call the operation #isServiceAlive on one of our internal servers.  but its failing because the proper headers are not set.  When I trace through the
execute request, I find 2 problems:
1) the soap namespace should be <soap:Enveloper> instead of <SOAP-ENV:Envelope>   I tracked this down to an internal dictionary and hacked the value to be what i want - but that doenst appear to be the correct way to change this.

2) headers are ignored in that the <SOAP-ENV:Header> tag is empty

the outgoing request looks like this
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:ns="http:// ...internal server... /types/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header/>
<soap:Body>
<ns:isServiceAliveElement>
<ns:msg></ns:msg>
</ns:isServiceAliveElement>
</soap:Body>
</soap:Envelope>

so - how do I properly set the soap namespace?
and finally:

how to get soap headers to work properly?


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: webservice with soap headers

Kogan, Tamara

Hello Jon,

 

It is hard to say why the headers were not added without the WSDL schema. 

 

execute request, I find 2 problems:
1) the soap namespace should be <soap:Enveloper> instead of <SOAP-ENV:Envelope>   I tracked this down to an internal dictionary and hacked the value to be what i want - but that doenst appear to be the correct way to change this.

It looks like the server has a problem parsing XML documents. The qualifier should not be a matter when DOM  is created. As far as I see the XML element below has correct Soap 1.1  namespace:

<soap:Envelope xmlns:ns="http:// ...internal server... /types/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">

See http://www.w3.org/TR/2000/NOTE-SOAP-20000508/#_Toc478383489. We set the default qualifier as “SOAP-ENV” but it can be any string.

 

2) headers are ignored in that the <SOAP-ENV:Header> tag is empty
It may be a few reasons and to detect a problem I need to see the Soap header description.

 

Tamara Kogan

Smalltalk Development

Cincom Systems

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Jon Paynter
Sent: Monday, January 23, 2012 2:50 PM
To: vwnc
Subject: [vwnc] webservice with soap headers

 

I cant seem to get soap headers to work with webservices.    Using 7.8, and based on the info in docs\Webservices.pdf I created the following workspace snippet:
| client result args arg |
args := OrderedCollection new.
arg := WebServices.Struct new.
arg at: #msg put: String new.
args add: arg.
client := WsdlClient url:  'http:// internal webserver .... ?WSDL'.
(client headerFor: #userId) value: 'myUserid'.
result := client executeSelector: #isServiceAlive args: args.
result.

im attempting to call the operation #isServiceAlive on one of our internal servers.  but its failing because the proper headers are not set.  When I trace through the
execute request, I find 2 problems:
1) the soap namespace should be <soap:Enveloper> instead of <SOAP-ENV:Envelope>   I tracked this down to an internal dictionary and hacked the value to be what i want - but that doenst appear to be the correct way to change this.

2) headers are ignored in that the <SOAP-ENV:Header> tag is empty

the outgoing request looks like this
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:ns="http:// ...internal server... /types/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header/>
<soap:Body>
<ns:isServiceAliveElement>
<ns:msg></ns:msg>
</ns:isServiceAliveElement>
</soap:Body>
</soap:Envelope>

so - how do I properly set the soap namespace?
and finally:

how to get soap headers to work properly?


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: webservice with soap headers

Jon Paynter-2


On Tue, Jan 24, 2012 at 6:41 AM, Kogan, Tamara <[hidden email]> wrote:

Hello Jon,

 

It is hard to say why the headers were not added without the WSDL schema. 

 

execute request, I find 2 problems:
1) the soap namespace should be <soap:Enveloper> instead of <SOAP-ENV:Envelope>   I tracked this down to an internal dictionary and hacked the value to be what i want - but that doenst appear to be the correct way to change this.

It looks like the server has a problem parsing XML documents. The qualifier should not be a matter when DOM  is created. As far as I see the XML element below has correct Soap 1.1  namespace:

<soap:Envelope xmlns:ns="http:// ...internal server... /types/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">

See http://www.w3.org/TR/2000/NOTE-SOAP-20000508/#_Toc478383489. We set the default qualifier as “SOAP-ENV” but it can be any string.

our internal webservices expect it to be '<soap:envelope>'  Im trying to copy the existing java functions, and they all send '<soap:Envelope>'  Ive managed to hack one of the global variables in my image.  I would much rather use a workspace expression to set the default qualifier.  Can you tell me what that would be?
 

 

2) headers are ignored in that the <SOAP-ENV:Header> tag is empty
It may be a few reasons and to detect a problem I need to see the Soap header description.
Im not sure what you mean here.

As per your documentation (Webservices.pdf page 5-6), I just add: (client headerFor: #headerKey) value: 'headervalue'
but when I use that, there are no values inside the <soap:Header> tags.
to determine this, I set a breakpoint in WebServices.SoapRequest>>executeTransportEntity: and step through the execute code until it writes to the output stream.  at that point the <soap:Header> tag is empty.  yet at the start of the #executeTransportEntity: method the soapRequest object has the headers populated.

Let me know if you need anything else.

 

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: webservice with soap headers

Kogan, Tamara

On Tue, Jan 24, 2012 at 6:41 AM, Kogan, Tamara <[hidden email]> wrote:

Hello Jon,

 

It is hard to say why the headers were not added without the WSDL schema. 

 

execute request, I find 2 problems:
1) the soap namespace should be <soap:Enveloper> instead of <SOAP-ENV:Envelope>   I tracked this down to an internal dictionary and hacked the value to be what i want - but that doenst appear to be the correct way to change this.

It looks like the server has a problem parsing XML documents. The qualifier should not be a matter when DOM  is created. As far as I see the XML element below has correct Soap 1.1  namespace:

<soap:Envelope xmlns:ns="http:// ...internal server... /types/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">

See http://www.w3.org/TR/2000/NOTE-SOAP-20000508/#_Toc478383489. We set the default qualifier as “SOAP-ENV” but it can be any string.

our internal webservices expect it to be '<soap:envelope>'  Im trying to copy the existing java functions, and they all send '<soap:Envelope>'  Ive managed to hack one of the global variables in my image.  I would much rather use a workspace expression to set the default qualifier.  Can you tell me what that would be?

[>]

(XMLObjectBinding bindingAtNamespace:  'http://schemas.xmlsoap.org/soap/envelope/') defaultQualifier: 'xxx'


  

2) headers are ignored in that the <SOAP-ENV:Header> tag is empty

It may be a few reasons and to detect a problem I need to see the Soap header description.

Im not sure what you mean here.

[>] I meant that without WSDL schema I can’t say the reason



As per your documentation (Webservices.pdf page 5-6), I just add: (client headerFor: #headerKey) value: 'headervalue'
but when I use that, there are no values inside the <soap:Header> tags.
to determine this, I set a breakpoint in WebServices.SoapRequest>>executeTransportEntity: and step through the execute code until it writes to the output stream.  at that point the <soap:Header> tag is empty.  yet at the start of the #executeTransportEntity: method the soapRequest object has the headers populated.

Let me know if you need anything else.

[>] Try to debug

SoapWsdl11OperationBinding>>marshalArguments: anArguments header: header bodyMarshaler: aMarshaler headerMarshaler: aHeaderMarshaler

If aHeaderMarshaler is nil the Soap header marshalers were not created for this request and the investigation should start from WSDL Soap header description



 


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: webservice with soap headers

Jon Paynter-2
On Tue, Jan 24, 2012 at 10:31 AM, Kogan, Tamara <[hidden email]> wrote:

On Tue, Jan 24, 2012 at 6:41 AM, Kogan, Tamara <[hidden email]> wrote:

Hello Jon,

 

It is hard to say why the headers were not added without the WSDL schema. 

Im not sure why the wsdl schema matters in this case, but the user/password/token/checksum and such that is needed are not specified in our wsdl schema.  They are stripped out by our internal SOA server and used for authentication. Our java clients have no issues adding this additional information.


See http://www.w3.org/TR/2000/NOTE-SOAP-20000508/#_Toc478383489. We set the default qualifier as “SOAP-ENV” but it can be any string.

our internal webservices expect it to be '<soap:envelope>'  Im trying to copy the existing java functions, and they all send '<soap:Envelope>'  Ive managed to hack one of the global variables in my image.  I would much rather use a workspace expression to set the default qualifier.  Can you tell me what that would be?

[>]

(XMLObjectBinding bindingAtNamespace:  'http://schemas.xmlsoap.org/soap/envelope/') defaultQualifier: 'xxx'

That works well - thanks

Let me know if you need anything else.

[>] Try to debug

SoapWsdl11OperationBinding>>marshalArguments: anArguments header: header bodyMarshaler: aMarshaler headerMarshaler: aHeaderMarshaler

If aHeaderMarshaler is nil the Soap header marshalers were not created for this request and the investigation should start from WSDL Soap header description


for my webservice call, aHeaderMarshaler has a value: "SoapHeaderMarshaler  child::Header class =WebServices.SoapHeader"

However looking over the method, it seems the only place the header marshaler is used is to set the envelope header, and from there it is ignored.

If you can let me know where the header entries are supposed to be marshaled, I can try to track down why the disconnect.


 


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: webservice with soap headers

Kogan, Tamara

It is hard to say why the headers were not added without the WSDL schema. 

Im not sure why the wsdl schema matters in this case, but the user/password/token/checksum and such that is needed are not specified in our wsdl schema.  They are stripped out by our internal SOA server and used for authentication. Our java clients have no issues adding this additional information.

 

See http://www.w3.org/TR/2000/NOTE-SOAP-20000508/#_Toc478383489. We set the default qualifier as “SOAP-ENV” but it can be any string.

our internal webservices expect it to be '<soap:envelope>'  Im trying to copy the existing java functions, and they all send '<soap:Envelope>'  Ive managed to hack one of the global variables in my image.  I would much rather use a workspace expression to set the default qualifier.  Can you tell me what that would be?

[>]

(XMLObjectBinding bindingAtNamespace:  'http://schemas.xmlsoap.org/soap/envelope/') defaultQualifier: 'xxx'

That works well - thanks

Let me know if you need anything else.

[>] Try to debug

SoapWsdl11OperationBinding>>marshalArguments: anArguments header: header bodyMarshaler: aMarshaler headerMarshaler: aHeaderMarshaler

If aHeaderMarshaler is nil the Soap header marshalers were not created for this request and the investigation should start from WSDL Soap header description


for my webservice call, aHeaderMarshaler has a value: "SoapHeaderMarshaler  child::Header class =WebServices.SoapHeader"

However looking over the method, it seems the only place the header marshaler is used is to set the envelope header, and from there it is ignored.

If you can let me know where the header entries are supposed to be marshaled, I can try to track down why the disconnect.

[>] The SoapHeaderMarshaler has to have #relations that are header entry marshalers.  For example running TestSoapHeaders>>test11ServiceWithHeaders from the  WebServicesDemo package gives the Soap header marshaler relations as:

 

OrderedCollection (ElementMarshaler  child::NotUnderstood OneRelation name=NotUnderstood RelationMarshaler  child::AuthenticationToken OneRelation name=AuthenticationToken RelationMarshaler  child::AccessLevel OneRelation name=AccessLevel)

where relation marshalers are going to marshal the authentication token and access level.

If there are header entry marshalers and the header value is provided the SoapHeaderMarshaler>>privateMarshalFrom: marshalingContext will encode the message header.

The result is in MarshalingContext>>source.

<SOAP-ENV:Header>

                <ns:AuthenticationToken SOAP-ENV:mustUnderstand="1">

                                <password xmlns="urn:LibraryDemo\testSoapHeaders">password</password>

                                <userID xmlns="urn:LibraryDemo\testSoapHeaders">UserID</userID>

                </ns:AuthenticationToken>

                <ns:AccessLevel SOAP-ENV:mustUnderstand="1">12345</ns:AccessLevel>

</SOAP-ENV:Header>




 

 


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc