Soap communication / sockets?

BGI
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
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
Benny Giebens
0
Comments
-
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?0 -
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.”0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions