Soap communication / sockets?

BGIBGI Member Posts: 176
Hi,
i'm trying to do some soap communication to a service...but i don't get it working...

this is the code

IF ISCLEAR(comcom) THEN
CREATE(comcom) ;
IF ISCLEAR(socket) THEN
CREATE(socket);

comcom.AddBusAdapter(socket,0);
Outmsg := comcom.CreateoutMessage('sockets://10.0.0.245:80');

outstr := Outmsg.GetStream;

tmpfile.WRITEMODE := TRUE;
tmpfile.CREATE('C:\test.txt');
tmpfile.CREATEOUTSTREAM(outstr);

outstr.WRITE('POST /CCMApi/AXL/V1/soapisapi.dll');
outstr.WRITE('Host: 10.0.0.245:80');
outstr.WRITE('Accept: text/*');
outstr.WRITE('Authorization: Basic YWRtaW46YXNjMG1CZQ==');
outstr.WRITE('Content-type: text/xml');
outstr.WRITE('Content-length: 613');
outstr.WRITE('<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"');
outstr.WRITE('xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"');
outstr.WRITE('xmlns:xsd="http://www.w3.org/2001/XMLSchema">');
outstr.WRITE('<SOAP-ENV:Body>');
outstr.WRITE('<axl:getPhone xmlns:axl="http://www.cisco.com/AXL/1.0"');
outstr.WRITE('xsi:schemaLocation="http://www.cisco.com/AXL/1.0 http://gkar.cisco.com/schema/axlsoap.xsd"');
outstr.WRITE('sequence="1234">');
outstr.WRITE('<phoneName>SEP222222222245</phoneName>');
outstr.WRITE('</axl:getPhone>');
outstr.WRITE('</SOAP-ENV:Body>');
outstr.WRITE('</SOAP-ENV:Envelope>');
tmpfile.CLOSE;
Outmsg.SendWaitForReply(10000);

instr := Outmsg.GetStream;
WHILE NOT instr.EOS DO BEGIN
instr.READTEXT(Result);
MESSAGE(Result);
END;


but whatever i do , the result is empty.
I tried also with soap sdk, but even there i can't get it working...
Someone any idea or suggestion for this code
Rgds
Benny Giebens

Comments

  • girish.joshigirish.joshi Member Posts: 407
    Can you create a listener socket reference and write to that instead?

    than in the application, make sure you are actually writing what you think you are to that socket.

    Have you tried running a telnet client on that port and writing your file to address directly?
  • Jorge_Torres_[MSFT]Jorge_Torres_[MSFT] Member, Microsoft Employee Posts: 29
    Try something like this:
    IF ISCLEAR(comcom) THEN 
    CREATE(comcom) ; 
    IF ISCLEAR(socket) THEN 
    CREATE(socket); 
    
    comcom.AddBusAdapter(socket,0); 
    Outmsg := comcom.CreateoutMessage('sockets://10.0.0.245:80'); 
    
    outstr := Outmsg.GetStream; 
    
    outstr.WRITEtext('POST /CCMApi/AXL/V1/soapisapi.dll'); 
    outstr.WRITETEXT();
    outstr.WRITEtext('Host: 10.0.0.245:80'); 
    outstr.WRITETEXT();
    outstr.WRITEtext('Accept: text/*'); 
    outstr.WRITETEXT();
    outstr.WRITEtext('Authorization: Basic YWRtaW46YXNjMG1CZQ=='); 
    outstr.WRITETEXT();
    outstr.WRITEtext('Content-type: text/xml'); 
    outstr.WRITETEXT();
    outstr.WRITEtext('Content-length: 613'); 
    outstr.WRITETEXT();
    outstr.WRITETEXT();   // HTTP conformance
    
    outstr.WRITEtext('<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"'); 
    outstr.WRITETEXT();
    outstr.WRITEtext('xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"'); 
    outstr.WRITETEXT();
    outstr.WRITEtext('xmlns:xsd="http://www.w3.org/2001/XMLSchema">'); 
    outstr.WRITETEXT();
    outstr.WRITEtext('<SOAP-ENV:Body>'); 
    outstr.WRITETEXT();
    outstr.WRITEtext('<axl:getPhone xmlns:axl="http://www.cisco.com/AXL/1.0"'); 
    outstr.WRITETEXT();
    outstr.WRITEtext('xsi:schemaLocation="http://www.cisco.com/AXL/1.0 http://gkar.cisco.com/schema/axlsoap.xsd"'); 
    outstr.WRITETEXT();
    outstr.WRITEtext('sequence="1234">'); 
    outstr.WRITETEXT();
    outstr.WRITEtext('<phoneName>SEP222222222245</phoneName>'); 
    outstr.WRITETEXT();
    outstr.WRITEtext('</axl:getPhone>'); 
    outstr.WRITETEXT();
    outstr.WRITEtext('</SOAP-ENV:Body>'); 
    outstr.WRITETEXT();
    outstr.WRITEtext('</SOAP-ENV:Envelope>'); 
    outstr.WRITETEXT();
    outstr.WRITETEXT();  // I cannot remember if this is needed.
    
    [color=red]Inmsg := [/color]Outmsg.SendWaitForReply(10000); 
    
    instr := [color=red]Inmsg[/color].GetStream; 
    WHILE NOT instr.EOS DO BEGIN 
    instr.READTEXT(Result); 
    MESSAGE(Result); 
    END;
    

    I have managed to get my SOAP service to respond in NAV (disabled authentication on my IIS), but you need to have the http authorization well done, if you want to use authentication.
    “This posting is provided "AS IS" with no warranties, and confers no rights.”
Sign In or Register to comment.