Problem calling web service built with C#

The web service I am trying to call is written in VS with C# and is running as a service.

I am attempting to connect to it using Delphi 2007 and RemObj SDK v6.0.55.957

After several failed attempts to call the simple “Ping” method published by the service using RemOB with a D2007 client I’ve come down to the following.

  1. By using SoapUI I can make a successful call to the service. The successful XML is in file attached to the first comment.

  2. Building a small test project with VS2010, it connects to the server fine, imports the wsdl, and makes a call without any problems

  3. With D2007 and rem objects, the following is the XML is generated and fails. The exception returned is “EROException ‘Bad Request(400)’” The failed XML is in file attached to the first comment.

My delphi test code is as follows:

procedure Foo
var
con: IConnIntf;
begin
Channel.Connected := True;
con := CoConnIntf.Create(aMessage, Channel);
con.Ping(nil);
end;

The Channel component only has the TargetURL property set and the Message component only has the SerializationOptions.xsoSoap12 set to true.

QUESTION:

Being as how I may not be very experienced with using RemObj are there properties, methods, or the like that someone can point out to get this functional? Any help would be appreciated.

ok… since the forum strips out tags and makes the xml unreadable, I have attached a text file with the xml samples.

Hello,
Can you send us your testcase which reproduces this error? We will check it and send you fixed.

Unfortunately I have NDA issues preventing me from posting the wsdl. And I don’t have control over the c# web service I’m consuming. I have included as much detail of the what I’m observing and how I’ve corrected the situation. My questions are at the bottom.

ISSUE #1:

I have solved my XML difference issue and found a new issue in the action attribute of the post. With regards to the xml envelope, the web service simply wants to see the addition of the following attribute in the envelope and 2 nodes in the header:

attribute:
xmlns:a=“http://www.w3.org/2005/08/addressing

nodes:
a:Action
http://Thermo.Connect/IHCSConnect/Ping
/a:Action

a:To
http://thermo-pc:2021/WSHCSConnect
/a:To

So I simply have added them manually into the envelope using the MessageEnvelopeComplete event.

ISSUE #2:

During my testing I have made a working call using HttpSendRequest and building the whole thing myself. Using this and a packet sniffer I have narrowed down my issue to a one thing. The soap action value being sent is not in acceptable format to the service. This unacceptable format is: urn:HCSConnect-WSHCSConnect#Ping

The fSoapAction value is set correctly from the wsdl values but then it is cleared
due to the fact that LibraryName, MessageName, and InterfaceName are blank strings. Then when the fSoapAction is blank, the above non-functional entry is added.

So now I have added the following code so the soap action is not cleared, and the value from the wsdl is used to call the C# service:

var
con: IWSHCSConnect;
begin
Channel.Connected := True;
with MyMessage do
begin
LibraryName := ‘HCSConnect’;
MessageName := ‘Ping’;
InterfaceName := ‘WSHCSConnect’;
end;
con := CoWSHCSConnect.Create(MyMessage, Channel);
con.Ping(nil);

…and I also had to change the generated _Intf file and add quotes to the action value in the ping function like this:

function TWSHCSConnect_Proxy.Ping(const Ping: Ping): UnicodeString;
begin

lMessage.SetAttributes(lTransportChannel, [‘Action’, … ] ,
[’“http://Thermo.Connect/IHCSConnect/Ping”’, …]);

end;

RESULT:

Attached text file has the post that works generated from rem obj. Of specific important is the soap action specified in the post parameters.

QUESTIONS:

Obviously the code to correct these issues is not extensive, but the investigation process was. Also, the reason to use these import libraries for web services is to avoid all the manual changes. Otherwise I can simply make the calls directly using HttpSendRequest, which I did during my R&D of this issue. Thinking I may have taken the long route due to not being very familiar RemObj here are my questions.

Issue #1 question:
Is there a way to have rem objects components add the necessary lines automatically instead of me having to manually do this in an event?

Issue #2 question:
a) Should not these values also be loaded into the message object by the information in the wsdl? And if not is there a property or method that would do this for me?
b) Is there a way to tell rem objects to add quotes to the action attribute so the result looks as the following

http://Thermo.Connect/IHCSConnect/Ping

instead of

http://Thermo.Connect/IHCSConnect/Ping

since the one without the quotes does not work…

davenovo said: ssue #1 question:
Is there a way to have rem objects components add the necessary lines automatically instead of me having to manually do this in an event?

Issue #2 question:
a) Should not these values also be loaded into the message object by the information in the wsdl? And if not is there a property or method that would do this for me?

Yes this should be done automatically, but without wsdl impossible to find out what was wrong. For example values in header is something new and will be interesting to look at it definition in wsdl.

davenovo said: Unfortunately I have NDA issues preventing me from posting the wsdl.

Maybe you can give some wsdl with same structure? As you understand concrete values is not important.

davenovo said: b) Is there a way to tell rem objects to add quotes to the action attribute so the result looks as the following

No, but it is just a string stored in RODL in custom attribute “Action” for operation, you can add quotes here:

						

  
    
    
    
  

After a bit of communication with our 3rd party they have approved me posting the wsdl. So here are all the wsdl files. The pages reference each other through imports.

Your wsdl is incomlete, wsdl:binding and wsdl:service sections are absent.

Both wsdl:binding and wsdl:service sections are in the wsdl.xml file within the zip that I attached to the post. Since the sections themselves are present, is there something specific within these sections that is missing?

–edit—
be advised there are imports in the wsdls that point to the next wsdl. I attempted to name each of the attached wsdl files according to the import location attribute (url). Obviously, to run the code gen off these files each “import” entry in the wsdls will have to be redirected to the actual file name on disk…

Hi.

Sorry, I missed first wsdl.

  1. Wrong “SOAPAction” HTTP header, this issue was logged as 52531 and will be fixed.
  2. Parameters in the header, this is Web Services Policy (http://www.w3.org/TR/ws-policy/), unfortunately RemObjects SDK doesn’t support this, so your workaround is the only one solution.