Consume .NET Web Service

kirsch59

Member
From an ABL program is there a way to consume a .NET web service and pass an object that is readable in .NET?

Thanks
Mark
 

TomBascom

Curmudgeon
Providing that you are not using some ancient, obsolete and unsupported release of Progress consuming a WS is easy.

The payload is usually XML. Which is also easy.
 

kirsch59

Member
I'm running OpenEdge 10.1C03. In the past, I've consummed a WS and passed XML. I would like the ABL program and the .Net WS to use the same namespace and objects. From the ABL program how do I pass an object that the .Net WS can read?
 

rstanciu

Member
Fist of all, document your .Net web-service
bprowsdldoc [options] WSDLURL [OutputDirectory]

take a look to the documentation, and copy-paste works
 

kirsch59

Member
In ABL I would like to define a class SXCustomerRequest, instantiate it and then call WS BlackboxServiceClient's method SendCustomer. The goal is to have the client and web service use the same class.

Here's the .NET/C# code that I would like to translate to ABL:


using System.Runtime.Serialization;
using BlackboxService.MessageBase;
using BlackboxService.Criteria;
using CIC_Business_Objects;

namespace BlackboxService.Messages
{
/// <summary>
/// Represents a customer request message from client.
/// </summary>
[DataContract(Namespace = "http://www.cicgo.com/types/")]
public class SXCustomerRequest
{
/// <summary>
/// Selection criteria
/// </summary>
[DataMember]
public int Cono;

[DataMember]
public int Custno;

[DataMember]
public string Shiptono;

}
}


SXCustomerRequest request = new SXCustomerRequest();
request.Cono = 1;
request.Custno = 1234;
request.Shiptono = "01";

BlackboxServiceClient.SendCustomer(request);

Do I have to use SAX writer to create the XML for "request" ?
I realize I have to CREATE SERVER, CONNECT...
Can I pass "request" as an input parameter when I call the WS's method?

 

kirsch59

Member
When I run bprowsdldoc I get the following abbreviated error message:
Cannot resolve URI
status code: 404
11748

I have successfully called the web service using longchar XML data. I have confidence that the .NET WS works.

I would like to be able to use a class as an input parameter when calling the WS
 

rstanciu

Member
check your WSLD file location or copy the WSDL file localy and execute:
bprowsdldoc [filename]

If bprowsdldoc arrives to documment the WSDL is OK you can consume the web-service in 4GL.
else ... don't spend your time ... nothing works, Progress is very strict on respect WSDL 1.0, XML 1.0 and UTF-8
If the service .Net was exposed on WS2 ... Progress don't understand ... forget.
 

TomBascom

Curmudgeon
As rstanciu says -- WSDL first. You have to get that to work before there is any hope of the rest of it working.

Unless a .NET class is somehow equivalent to XML this doesn't make much sense. And that code sample doesn't look at all like XML to me. You aren't going to get the 4GL to understand a C# class like that -- you will have to somehow transform it to XML first. *Maybe* bprowsdldoc will know what to do with it. But I'm not holding my breath.
 

medu

Member
There is no option to pass an object through a web-service call unless it's serialized in someway that both ends understand, be it XML or binary but it has to be serialized to travel over the wire :)

Your .Net code is using System.Runtime.Serialization with data contract and member annotations which depending on what contract serializer you use might end-up as plain XML (NetDataContractSerializer). If you were in 10.2A+ you'll had access to .Net assemblies from ABL and could potentially try to use the .Net serialization to load the XML back to a similar .Net object, not an ABL object.

However serializing in XML and pass that as a plain output string in your .Net web-service will get your data over the wire and you can start implementing some 'de-serialization' routine to have the ABL object created from that XML you get, how is the .Net WSDL look like... probably the serialization data contract adds some strange namespace related attributes that Progress does not understand, try to see if you can simply change the output to be 'String' – the object XML serialization.
 

kirsch59

Member
It looks like ABL cannot handle a C# class and ABL will not support the serialization of nonXML data. The WS and ABL client will not use the same class. The bottom line is I will not pass a class/object when I call the WS. I will use XML as the WS's input parameter.
 
Top