1. O E
  2. PowerBuilder
  3. Monday, 3 June 2019 14:07 PM UTC

Hello,

is there an option to use custom headers in webservice proxy?

I have to consume a SoapWebservice wich needs the following custom headers:

customerSignature, customerNumber, interfacePartnerNumber, interfacePartnerSignature and customerLogin.

1
2
3
4
5
6
7
8
9
10
11
12
13
POST https://www.dat.de/FinanceLine/services/Evaluation HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
SOAPAction: "getVehicleApproximateValue"
customerSignature: jA0EAwxyz...
customerNumber: 9999999
interfacePartnerNumber: 9999999
interfacePartnerSignature: jA0EAwzyx...
customerLogin: myLogin
Content-Length: 759
Host: www.dat.de
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)

This is very easy to do in SoapUI or in JAVA, but I didn't find a way to do this in Powerbuilder.

I'm using PB2017 R3 1880.

O E Accepted Answer Pending Moderation
  1. Wednesday, 5 June 2019 06:35 AM UTC
  2. PowerBuilder
  3. # 1

Thanks for your Responses.

I hoped that there is an way,  I can use the WSDL-Files because of the very complexe structures the webservice returns.

So the only way to use custom soap headers is the htttpclient?

I used the htttpclient for restful webservices with json, often. 

Complexe xml-structures are hard to handle with string-functions.

Anyone got an idea how I could use the structures (from wsdl generated by proxy) to use with the httpclient?

 

Comment
  1. Kevin Ridley
  2. Thursday, 6 June 2019 13:30 PM UTC
You can try using PBDOM to process the returned xml and populate the objects that you generated. Also maybe check and see if the service provider has a RESTful service you can call instead.
  1. Helpful
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Tuesday, 4 June 2019 17:57 PM UTC
  2. PowerBuilder
  3. # 2

I ran a test where I used HTTPClient to call a web service that returns all the HTTP server variables. The result was:

HTTP_CONNECTION: Keep-Alive
HTTP_HOST: localhost

The Connection option defaults to Keep-Alive so you don't need to specify it unless you want it to be something different.

You shouldn't have to specify the Host either, as the host name is passed along by the underlying TCP/IP connection.

You won't need Content-Length or User-Agent unless there is code in the web service that is looking for them. For example, it may be tracking what type of browser is being used by the end user.

Comment
There are no comments made yet.
Kevin Ridley Accepted Answer Pending Moderation
  1. Tuesday, 4 June 2019 15:03 PM UTC
  2. PowerBuilder
  3. # 3

You should be able to call the web service using the HTTPClient, which is probably what you are asking.  You will want to use the setrequestheader function for the custom headers and sendrequest("POST", "https://www.dat.de/FinanceLine/services/Evaluation") after the custom headers are set.  You shouldn't need the last 4 that you show above, starting with Content-Length.

 

Comment
  1. David Peace (Powersoft)
  2. Tuesday, 4 June 2019 15:08 PM UTC
I agree with Kevin
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.