Resolved httpclient help
- How-to
- Gimmy Susan
- PowerBuilder
- Thursday, 25 February 2021 06:53 PM UTC
Hi
I am converting the old 'web service proxy' calls to the new 'httpclient'.
I'm running the directions in 'https://www.appeon.com/developers/get-help/knowledgebase/call-soap-web-service-using-httpclient-object.html', but it doesn't work. (performed by browser all work well)
To debug I have created a small web service and I ask you for help.
I have this very simple web service (*) that I have successfully published in my local IIS.
Calling it from the browser everything works.
if I try to call it from Powerbuilder (**) it doesn't work.
In particular
lo_client.GetResponseStatusCode () returns 500.
Why?
Some idea ?
Thanks in advance for the reply
Gimmy
p.s.: Ecosystem: Pb2019r3 build 2670 + Runtime 19.2.2670 - windows 10 64bit -
* web service code:
=============
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.Services;
using System.Data;
using Newtonsoft.Json;
using System.Data;
using Oracle.ManagedDataAccess.Client;
namespace ProgenAM
{
[WebService(Namespace = "http://ateikon.com/webservices/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
public class CoGe : System.Web.Services.WebService
{
[WebMethod]
public string xxx(string _cdazie)
{
return _cdazie + " add something";
}
}
}
(**) Powerbuilder 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 ="http://www.jakaa.locale/Coge.asmx"
ls_body = '<?xml version="1.0" encoding="utf-8"?>'+&
'<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">'+&
' <soap:Body>'+&
' <xxxResponse xmlns="http://ateikon.com/webservices/">'+&
' <xxxResult>Gimmy</xxxResult>'+&
' </xxxResponse>'+&
' </soap:Body>'+&
'</soap:Envelope>'
lo_client = Create httpClient
lo_client.SetRequestHeader("Content-Type", "text/xml")
lo_client.sendrequest('POST',ls_url,ls_body)
li_StatusCode = lo_client.GetResponseStatusCode()
ls_ret = lo_client.GetResponseStatusText( )
li_ret = lo_client.getresponsebody( ls_data)
destroy lo_client
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.