1. New User
  2. PowerBuilder
  3. Friday, 12 August 2022 07:35 AM UTC



i am trying to consume a WCF service and i am getting status code 400(Bad Request)  in httpclient response. can anyone guide me what is wrong in consuming / calling the service ?

i want to call "GetCMSWorkQueue"method of service wkfqueuemanager.svc, can somebody tell me what's the problem



PB code


httpClient lo_client
integer li_ret , i , li_StatusCode
String lo_xml_request
string ls_url
string ls_data
string ls_body
string ls_ret

ls_url =""

ls_body = '<?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/"><soapenv:Header/><soapenv:Body><tem:ReceiveRequestNotifications><!--Optional:--><tem:userName>t3</tem:userName><!--Optional:--><tem:flag>F</tem:flag></tem:ReceiveRequestNotifications></soapenv:Body></soapenv:Envelope>'

lo_client = Create httpClient

//lo_client.SetRequestHeader("Content-Type", "text/xml")

lo_client.SetRequestHeader("Content-Type", "application/soap+xml; charset=utf-8")


li_StatusCode = lo_client.GetResponseStatusCode()

ls_ret = lo_client.GetResponseStatusText( )

li_ret = lo_client.getresponsebody( ls_data)

destroy lo_client



statuscode 400

"Bad Request"

mike S Accepted Answer Pending Moderation
  1. Friday, 12 August 2022 13:07 PM UTC
  2. PowerBuilder
  3. # 1

I'd used postman to get it to work, to eliminate coding things wrong.  Once you can call it correctly, it will be easier to get it to work in whatever you are writing the program in.

There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Friday, 12 August 2022 12:58 PM UTC
  2. PowerBuilder
  3. # 2
  1. New User
  2. Friday, 12 August 2022 13:31 PM UTC
i have already looked and followed the steps but getting the same bad request response
  1. Helpful 1
There are no comments made yet.
René Ullrich Accepted Answer Pending Moderation
  1. Friday, 12 August 2022 08:07 AM UTC
  2. PowerBuilder
  3. # 3

The message says that it expects application/soap+xml. You send text/xml.

Change the SetrequestHeader call to set the Content-Type as server needs.

  1. New User
  2. Friday, 12 August 2022 09:53 AM UTC
i have set like

lo_client.SetRequestHeader("Content-Type", "application/soap+xml; charset=utf-8")

but still get the same "Bad Request" response.

can you check body code. i copied this code from soupui. is it what which i should put in body ?

ls_body ='<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"; xmlns:tem="http://tempuri.org/"><soapenv:Header/><soapenv:Body><tem:GetCMSWorkQueue><!--Optional:--><tem:userName>t3</tem:userName></tem:GetCMSWorkQueue></soapenv:Body></soapenv:Envelope>'

  1. Helpful
  1. Brad Mettee
  2. Friday, 12 August 2022 12:45 PM UTC
In the SOAPUI window, the URL you have is mixed case, and your code has it in all lower (for the first portion). Request might be failing if webservice is case sensitive. It's also a different spelling.

code = wkfqueuemanager.svc

  1. Helpful 1
  1. New User
  2. Friday, 12 August 2022 13:30 PM UTC
sorry i uploaded the wrong pic now i have updated
  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.