Search code examples
wcf.net-4.0ibm-midrangerpgle

SOAP statement for WCF Service


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?


Solution

  • 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