Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Missing Soap Header / Authentification?

731 views
Skip to first unread message

Josh Crawford

unread,
Jan 22, 2007, 6:00:16 PM1/22/07
to
I'm missing the header for authentication. Here is my generated request and
an example of what the request should look like followed by my code. Any
ideas why it's excluding the header information?

------ generated 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:Body>
<request req_id="123">
<ind_mis_lookup>
<ssn>123-45-6789</ssn>
</ind_mis_lookup>
</request>
</soap:Body>
</soap:Envelope>

-------- expected request -------------------
<?xml version="1.0" encoding="UTF-8"?>
<soap-env:Envelope
xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
<soap-env:Header>
<wsse:Security
xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/04/secext">
<wsse:UsernameToken>
<wsse:Username>UN</wsse:Username>
<wsse:Password>PASSWORD</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soap-env:Header>
<soap-env:Body>
<request req_id="123">
<ind_mis_lookup>
<ssn>123-45-6789</ssn>
</ind_mis_lookup>
</request>
</soap-env:Body>
</soap-env:Envelope>

--------- code --------------
// .Net Soap Test
SoapConnection conn // Define SoapConnection
mislookup proxy_obj // Declare proxy
long ll_rc

// request vars
request_type request
ind_mis_lookup_type ind_mis_lookup
string ssn
string req_id

// response vars
response_type response

conn = create SoapConnection //Instantiated connection
ll_rc = conn.CreateInstance( proxy_obj, 'mislookup' )
ll_rc = conn.SetBasicAuthentication ('', 'UN', 'PASSWORD')

// set request variable
req_id = "123"

ssn = "123-45-6789"

ind_mis_lookup.ssn = ssn

request.req_id = req_id
request.ind_mis_lookup = ind_mis_lookup

TRY
response = proxy_obj.individualmislookup( request )
messagebox("Test", "req_id: " + response.req_id)
CATCH ( SoapException e )
MessageBox( "SOAP Exception", e.Getmessage() )
END TRY


DESTROY conn


Bruce Armstrong [TeamSybase]

unread,
Jan 22, 2007, 6:04:55 PM1/22/07
to

What version of PB are you using? Are you using the EasySOAP or the .Net
engine?

"Josh Crawford" <mon...@hotmail.com> wrote in message
news:45b55010$1@forums-1-dub...

Bruce Armstrong [TeamSybase]

unread,
Jan 22, 2007, 8:54:01 PM1/22/07
to

AFAIK, SetBasicAuthentication doesn't send the information in the soap
headers. The only security mechanism that does that is the custom
SOAP headers option:

http://msdn2.microsoft.com/en-us/library/w67h0dw7.aspx

That's something added support for with the 10.5.1 MR.

On 22 Jan 2007 17:16:40 -0700, "Josh Crawford" <mon...@hotmail.com>
wrote:

>PB10.5 and using .Net engine.
>
>"Bruce Armstrong [TeamSybase]" <NOCANSPAM_br...@teamsybase.com>
>wrote in message news:45b55127$1@forums-1-dub...

Josh Crawford

unread,
Jan 22, 2007, 7:16:40 PM1/22/07
to
PB10.5 and using .Net engine.

"Bruce Armstrong [TeamSybase]" <NOCANSPAM_br...@teamsybase.com>
wrote in message news:45b55127$1@forums-1-dub...
>

Josh Crawford

unread,
Jan 25, 2007, 4:03:44 PM1/25/07
to
In this web page
http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.dc00357_1051/html/newfeat1051/CEGDCFJF.htm
it talks about generating structures from the Web service's SOAP header
class. Is this from the wsdl? Is there any other documentation for this?

"Bruce Armstrong [TeamSybase]" <NOCANSPAM_br...@teamsybase.com>
wrote in message news:u7tar2ls4dm5gjs1m...@4ax.com...

Bruce Armstrong [TeamSybase]

unread,
Jan 26, 2007, 12:12:03 AM1/26/07
to
On 25 Jan 2007 14:03:44 -0700, "Josh Crawford" <mon...@hotmail.com>
wrote:

>In this web page

>http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.dc00357_1051/html/newfeat1051/CEGDCFJF.htm
>it talks about generating structures from the Web service's SOAP header
>class. Is this from the wsdl?

Yes.

>Is there any other documentation for this?

None that I know of.


Josh Crawford

unread,
Jan 26, 2007, 6:10:20 PM1/26/07
to
Are there any wsdl files with an example of the soap header?

"Bruce Armstrong [TeamSybase]" <NOCANSPAM_br...@teamsybase.com>
wrote in message news:536jr25pnj6bdrohs...@4ax.com...

Bruce Armstrong [TeamSybase]

unread,
Jan 26, 2007, 7:38:33 PM1/26/07
to

I did an example of calling eBay with it:
http://teamsybase.net/blogs/?p=144

"Josh Crawford" <mon...@hotmail.com> wrote in message

news:45ba986c@forums-1-dub...

Josh Crawford

unread,
Jan 30, 2007, 8:03:57 PM1/30/07
to
Is there a wsdl that goes along with this example? I have to create my own
wsdl and can't figure out how to get PB not to give me an error when I'm
creating the dll in the wizard.

"Bruce Armstrong [TeamSybase]" <NOCANSPAM_br...@teamsybase.com>
wrote in message news:45baad19$1@forums-1-dub...

Bruce Armstrong [TeamSybase]

unread,
Jan 30, 2007, 8:09:35 PM1/30/07
to

You get the WSDL from eBay.

http://developer.ebay.com/webservices/latest/eBaySvc.wsdl

On 30 Jan 2007 18:03:57 -0700, "Josh Crawford" <mon...@hotmail.com>

Josh Crawford

unread,
Jan 31, 2007, 8:09:28 PM1/31/07
to
I'm getting closer. I fixed my wsdl and PB generated the set function and
corresponding structures for the header. I'm still not getting a header when
the soap envelope is sent, just the body. Here's my code. Am I missing
something? setSecurity is the generated function for my header and
security_type is the structure. There are several other variables in the
structure that I am unfamiliar with such as didunderstand, mustunderstand,
relay, actor, role. Do these need to be set so the header is inserted in the
envelope?

request_type request
ind_mis_lookup_type ind_mis_lookup
string ssn
string req_id

// header vars
security_type security
usernametoken_type usernametoken

// response vars
response_type response

conn = create SoapConnection //Instantiated connection
ll_rc = conn.CreateInstance( proxy_obj, 'mislookup' )

// set header vars
usernametoken.username = 'USER'
usernametoken.password = 'PASS'
security.usernametoken = usernametoken

// set request variable
req_id = "123"
ssn = "123-45-6789"
ind_mis_lookup.ssn = ssn
request.req_id = req_id
request.ind_mis_lookup = ind_mis_lookup

// set security
lb_rc = proxy_obj.setSecurity( security )

TRY
response = proxy_obj.individualmislookup( request )
messagebox("Test", "req_id: " + response.req_id)
CATCH ( SoapException e )
MessageBox( "SOAP Exception", e.Getmessage() )
END TRY


DESTROY conn


"Josh Crawford" <mon...@hotmail.com> wrote in message

news:45b92940@forums-1-dub...

Christian Blanco Hilm

unread,
Feb 28, 2007, 10:03:19 AM2/28/07
to
Hi Josh.
I'm having the exact same problem as you.
Even though I use the automatically generated set functions (as described in
http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.dc00357_1051/html/newfeat1051/CEGDCFJF.htm),
the SOAP header isn't part of the request.
I'm using PB 10.5.1 build 6021, and custom header support should be
available from build 5034. I've also tried with the latest available build
6565 but with the same result.
I populate the required structures which should be passed as arguments to
the set functions, but even though the functions return true, the header is
still missing.
In my case, the two header classes in question are just simple string types:

<simpleType name="KommunenummerType">
<restriction base="string">
<maxLength value="4"/>
</restriction>
</simpleType>

<simpleType name="CprType">
<restriction base="string">
<maxLength value="10"/>
</restriction>
</simpleType>

The corresponding fields in the generated structures are named 'text' and
the datatypes are string arrays, which I find a little strange. I've tried
renaming the fields and changing the types to strings but with no success.
Did you find a solution to the problem?
Regards,
Christian Blanco Hilm.


"Josh Crawford" <mon...@hotmail.com> wrote in message

news:45c14bd8$1@forums-1-dub...

Josh Crawford

unread,
Mar 15, 2007, 11:59:24 AM3/15/07
to
I finally figured out the problem. These variables must be set before the
call to setSecurity() (my header variable is named security). Evidently the
custom header won't be generated if they are null. Once I set these it
worked like a charm.

////////////////////////////////////
security.encodedmustunderstand = "0"
security.encodedmustunderstand12 = "0"
security.encodedrelay = "0"
////////////////////////////////////

"Christian Blanco Hilm" <chbh_r...@hotmail.com> wrote in message
news:45e599b7$1@forums-1-dub...

Bruce Armstrong [TeamSybase]

unread,
Mar 15, 2007, 1:50:18 PM3/15/07
to
Sorry for chiming in late. I ran into that as well. If any attribute of
the structure isn't set, it doesn't get included. I opened a case with it
with Sybase some time ago, but I don't know if they consider it a bug or
just something they need to make clear in the documentation.

"Josh Crawford" <mon...@hotmail.com> wrote in message

news:45f96d5c$1@forums-1-dub...

Christian Blanco Hilm

unread,
Mar 21, 2007, 8:21:20 AM3/21/07
to
Hi Josh and Bruce.
First of all, thank you, Josh, for pointing me in the right direction.
I'm one step further, because now I'm able to generate a SOAP header.
The bad news are that it seems like PB doesn't support more than one
parameter in the header.
In my case I have two headers 'Kommunenummer' and 'Cpr' as specified below.

<simpleType name="KommunenummerType">
<restriction base="string">
<maxLength value="4"/>
</restriction>
</simpleType>

<simpleType name="CprType">
<restriction base="string">
<maxLength value="10"/>
</restriction>
</simpleType>

For test purposes, I populate the two auto generated structures as follows:

//soap header structures
p_kommuneNummerType lstr_kommuneNummer
p_cprType lstr_cpr

//populate soap header structures
lstr_kommuneNummer.text[1] = "147"
lstr_kommuneNummer.mustunderstand = true
lstr_kommuneNummer.encodedmustunderstand = "0"
lstr_kommuneNummer.encodedmustunderstand12 = "0"
lstr_kommuneNummer.encodedrelay = "0"

lstr_cpr.text[1] = "9272727279"
lstr_cpr.mustunderstand = true
lstr_cpr.encodedmustunderstand = "0"
lstr_cpr.encodedmustunderstand12 = "0"
lstr_cpr.encodedrelay = "0"

I call the two auto generated set functions like this:

lws_pem.setCpr(lstr_cpr)
lws_pem.setKommunenummer(lstr_kommuneNummer)

When multiple set functions are called, it seems like the latest one is the
one which is used in the header.
When I call setKommunenummer first and setCpr second, the information
regarding 'Cpr' is correct, but 'Kommunenummer' is omitted from the
generated header. When I call setCpr first and setKommunenummer second, I
observe that the 'Kommunenummer' value 147 is inserted between the Cpr
header tags:

xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Header><cpr
soap:mustUnderstand="1"
xmlns="http://dk.acure.pem.security">147</cpr></soap:Header><soap:Body><GetMedicineCardStructure
xmlns="http://www.dkma.dk/homecare/xml.schema/2006.05.11"><PersonCivilRegistrationIdentifier
xmlns="http://rep.oio.dk/cpr.dk/xml/schemas/core/2005/03/18/">0404441019</PersonCivilRegistrationIdentifier></GetMedicineCardStructure></soap:Body></soap:Envelope>

I would expect something like this:

xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Header><cpr
soap:mustUnderstand="1"
xmlns="http://dk.acure.pem.security">0404441019</cpr><kommunenummer
soap:mustUnderstand="1"
xmlns="http://dk.acure.pem.security">147</kommunenummer></soap:Header><soap:Body><GetMedicineCardStructure
xmlns="http://www.dkma.dk/homecare/xml.schema/2006.05.11"><PersonCivilRegistrationIdentifier
xmlns="http://rep.oio.dk/cpr.dk/xml/schemas/core/2005/03/18/">0404441019</PersonCivilRegistrationIdentifier></GetMedicineCardStructure></soap:Body></soap:Envelope>

But I'm not able to get the 'Kommunenummer' tag into the SOAP header.
Is this the intended functionality or is it a bug?
Regards,
Christian Blanco Hilm.


Bruce Armstrong [TeamSybase]

unread,
Mar 21, 2007, 8:56:29 AM3/21/07
to

I'd recommend opening up a case with Sybase on this one.

On 21 Mar 2007 04:21:20 -0800, "Christian Blanco Hilm"

Jose Rico

unread,
May 9, 2007, 9:58:23 AM5/9/07
to
Hi Christian

How do you do the auto generated set functions ?

Are they functions from PB, from the Web Service or you invented them to insert
some elements in the soap header ?

Thanks

Jose Rico


On 21 Mar 2007 04:21:20 -0800,

in sybase.public.powerbuilder.webservices

Christian Blanco Hilm

unread,
May 16, 2007, 3:43:56 AM5/16/07
to
Hi Jose.
The functions are automatically generated by PowerBuilder's web service
proxy generator based on the information in the WDSL file.
Take a look at
http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.dc00357_1051/html/newfeat1051/CEGDCFJF.htm
There seems to be a bug in PowerBuilder, though, so the functionality
doesn't work properly, but we have reported it to Sybase and expect to hear
from them soon. I'll post in this thread, when I know more.
Regards,
Christian.


"Jose Rico" <jr...@e-infoauto.com> wrote in message
news:4641d37f@forums-1-dub...

Bruce Armstrong [TeamSybase]

unread,
May 16, 2007, 12:39:20 PM5/16/07
to
What bug are you referring to?

"Christian Blanco Hilm" <chbh_r...@hotmail.com> wrote in message
news:464ab63c@forums-1-dub...

Christian Blanco Hilm

unread,
May 21, 2007, 3:57:00 AM5/21/07
to
Hi Bruce.
The presumed bug I'm referring to seems to be in the PB wizard when the WSDL
has more than one <wsdl...:header message=...>.
Apparently, the PB wizard doesn't understand this properly and consequently,
the SOAP header isn't generated the way it is supposed to.
We have reported this to Sybase Denmark who is in contact with Dave Fish and
engineering so the exact cause of the problem can be found.
Regards,
Christian.


"Bruce Armstrong [TeamSybase]" <NOCANSPAM_br...@teamsybase.com>
wrote in message news:464b33b8$1@forums-1-dub...

huoy...@yahoo.com.cn

unread,
Jun 4, 2007, 5:24:39 AM6/4/07
to
hi
I'm use java Xfire to create a ws.the ws have SOAP Header
Authentication with Handlers.
test in java client is succeed.
but in pb,it can't find some structures in my wsdl file
//wsdl file

<?xml version="1.0" encoding="UTF-8" ?>
- <wsdl:definitions targetNamespace="http://Sever" xmlns:tns="http://
Sever" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc11="http://
schemas.xmlsoap.org/soap/encoding/" xmlns:soapenc12="http://www.w3.org/
2003/05/soap-encoding" xmlns:soap11="http://schemas.xmlsoap.org/soap/
envelope/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
- <wsdl:types>
- <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
attributeFormDefault="qualified" elementFormDefault="qualified"
targetNamespace="http://Sever">
- <xsd:element name="find">
- <xsd:complexType>
- <xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1" name="in0" nillable="true"
type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
- <xsd:element name="findResponse">
- <xsd:complexType>
- <xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1" name="out" nillable="true"
type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
- <wsdl:message name="findRequest">
<wsdl:part name="parameters" element="tns:find" />
</wsdl:message>
- <wsdl:message name="findResponse">
<wsdl:part name="parameters" element="tns:findResponse" />
</wsdl:message>
- <wsdl:portType name="findbookPortType">
- <wsdl:operation name="find">
<wsdl:input name="findRequest" message="tns:findRequest" />
<wsdl:output name="findResponse" message="tns:findResponse" />
</wsdl:operation>
</wsdl:portType>
- <wsdl:binding name="findbookHttpBinding"
type="tns:findbookPortType">
<wsdlsoap:binding style="document" transport="http://
schemas.xmlsoap.org/soap/http" />
- <wsdl:operation name="find">
<wsdlsoap:operation soapAction="" />
- <wsdl:input name="findRequest">
<wsdlsoap:body use="literal" />
</wsdl:input>
- <wsdl:output name="findResponse">
<wsdlsoap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
- <wsdl:service name="findbook">
- <wsdl:port name="findbookHttpPort"
binding="tns:findbookHttpBinding">
<wsdlsoap:address location="http://localhost:8080/findbook/services/
findbook" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
how can i configure my wsdl file thanks.

Bruce Armstrong [TeamSybase]

unread,
Jun 4, 2007, 8:52:49 AM6/4/07
to

What version of PB are you using? Only the 10.5.1 version of the .Net
engine supports authentication header tags.

It looks like you cut and paste that WSDL out of the display in IE,
because there's a bunch of garbage embedded it in that IE usually
inserts when displaying a WSDL. How about attaching a version that
doesn't contain the garbage.

huoy...@yahoo.com.cn

unread,
Jun 4, 2007, 9:17:03 PM6/4/07
to
i'm using PowerBuilder 10.5.1 Enterprise
about wsdl file i'm not
custom a wsdl
in java xfire,,just modify services.xml,i use some property.
like this:
//services.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xfire.codehaus.org/config/1.0">

<service>
<name>findbook</name>
<serviceClass>Sever.IFindBook</serviceClass>
<implementationClass>Sever.FindBook</implementationClass>
<style>wrapped</style>
<use>literal</use>
<scope>application</scope>
<inHandlers>
<handler handlerClass="Sever.ValidateUserTokenHandler"/>
</inHandlers>

</service></beans>
//-----------------------------------------------
i'm using inHandlers property,but wsdl file is automatic to build.

Bruce Armstrong [TeamSybase]

unread,
Jun 5, 2007, 12:34:43 AM6/5/07
to
Regardling the WSDL, look at all the hyphens in the WSDL you
presented. WSDL doesn't contain hyphen between tags. That's
something Internet Exploder adds when you view any XML file with it.

Perhaps because it was pasted in as text, it also contains a lot of
line breaks in inappropriate places.

It also appears that the SoapAction attribute for your method has a
null reference, but that's perhaps not a critical error.

However, most likely the problem you have is that your web service
isn't including the wsse:security tags to indicate what custom headers
it's expecting. Without that information, the proxy generator had no
idea what to send, or that the web service is expecting anything:

http://www.theserverside.com/tt/articles/article.tss?l=WebServicesWSDL

leo...@gmail.com

unread,
Sep 25, 2014, 11:00:22 AM9/25/14
to
Old topic but saved my day. Thank you very much all.
0 new messages