Question

I asked about consuming a WCF service from RPG here and received this response: Scott Klement has a presentation and examples: http://www.scottklement.com/presentations/#HTTPAPI

I used SoapUI to test my service and also to get he soap statement to be used with HTTAPI. The service returnes data in SoapUI but I have been unsuccessful using it in the RPG program. SoapUI returns the following, but it seems only to work within SoapUI - it also doesn't include the path to my service which is

http://ServerName/COE/CustByNameList.svc 

If I navigate to http://ServerName/COE/CustByNameList.svc?wdsl, I get the wsdl.

Statement returned in SoapUI:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">
   <soapenv:Header/>
   <soapenv:Body>
      <tem:GetCustomerData>
         <!--Optional:-->
         <tem:CustomerNumber>1688</tem:CustomerNumber>
      </tem:GetCustomerData>
   </soapenv:Body>
</soapenv:Envelope>

The result looks like this:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><GetCustomerDataResponse xmlns="http://tempuri.org/"><GetCustomerDataResult xmlns:a="http://schemas.datacontract.org/2004/07/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><a:List xmlns:b="http://schemas.datacontract.org/2004/07/WebOrderEntry.Lists"><b:PartialCSTMS><b:ADR19A>3910 LAKEFIELD DR             </b:ADR19A><b:ADR29A>JOHNS CREEK FACILITY          </b:ADR29A><b:CITY9A>SUWANEE                  </b:CITY9A><b:CST_x0023_9A>1688</b:CST_x0023_9A><b:NAME9A>JOHNSON CONTROLS              </b:NAME9A><b:PHON9A>770-495-9950        </b:PHON9A><b:STAT9A>GA</b:STAT9A><b:ZIPC9A>30024     </b:ZIPC9A></b:PartialCSTMS></a:List></GetCustomerDataResult></GetCustomerDataResponse></s:Body></s:Envelope>

I keep getting 500 internal server errors. I've tried numerous variations of the SOAP statement based on the examples I have seen, but they date back to 2008. Has anyone been successful with calling a WCF service from RPG?

Was it helpful?

Solution 3

I had to throw the towel in on using HTTPAPI to consume my WCF web service - just could not get past HTTP 400 and 500 errors. Logging wasn't helping. I believe I finally managed to get the SOAP call correct but then started receiving errors that seemed to translate into special character issues.

Instead, I ended up using IBM's IWS and got it working. These two links were of great help:

http://www.ibm.com/developerworks/ibmi/library/i-amrawsdl2rpg/index.html

http://www.iprodeveloper.com/article/rpg-programming/consume-web-services-with-ibms-iws-66209

OTHER TIPS

I asked my Twitter network and @alexeivbaranov responded with the following:

Try to compare request & response from SoapUI and your RPG client using TcpMon. As I understand your SoapUI req works fine but RPG req gets 500, so problem in request. Compare them.

Check your headers. You may be missing the soap action. Here is an example of a request to a WCF service exposed using WsHttp binding with security enabled. wsa:Action is the thing you might need.

<?xml version="1.0" encoding="ISO-8859-1" ?>
<soapenv:Envelope
    xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"
    xmlns:ns="http://somenamespace">
    <soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
        <wsa:Action>http://someuri/Get</wsa:Action>
        <wsa:To>http://localhost/someapp/SomeService.svc</wsa:To>
    </soapenv:Header>
    <soapenv:Body>
        <ns:GetRequest>
            <ns:Body>
                <ns:Id>12345</ns:Id>
            </ns:Body>
        </ns:GetRequest>
    </soapenv:Body>
</soapenv:Envelope>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top