SOAP statement for WCF Service - wcf

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?

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>

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

Related

SOAP webservice consuming vb.net

I am new to SOAP webservices, I was given a folder which consists of WSDL, .xsd files. and asked to consume a end point url. "https://abc-bus-dev.xyz.org/service/admin/Update/v", From the WSDL i am able to create a proxy classes for body part but from envelop to body i dont see anything in the wsdl. When i checked with them they asked to create a custom header. I was not sure how to create customer header with name spaces. Also can you please let me know how to add the header to the body and form the XML and send the request and receive response. Can any one please guide me so i can work accordingly and proceed further. i am really in a bad and tough situation, i am writing the code in vb.net
The soap request look like below:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://testing.testing.ws.testing.com/">
<soapenv:Header>
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:UsernameToken wsu:Id="UsernameToken-1" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:Username>Testing</wsse:Username>
<wsse:Password>123456</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
<trans:Method1>
<!--Optional:-->
<com:UserinfoId>123456</com:UserinfoId>
<sub:params>
<!--Optional:-->
<name>Testing</name>
<!--Optional:-->
<value>98765-45678</value>
</sub:params>
</trans: Method1 >
Right click on the vb.net project and select add --> service reference. It will generate the classes needed to call the webservice.
Then you call the webservice like this. Replace ServiceReference1 with what you named the service. Replace SoapClient with the name service Client
Dim service = new ServiceReference1.SoapClient
The url you posted is not publicly accessible so I could not add a service reference to it

Getting Login Faliure with error code 0

I'm using Yodlee SOAP API endpoints and in my error logs I'm getting Site Refresh Status as LOGIN_FAILURE with error code 0 (which as I understand is not an error according to Yodlee docs). I was wondering what could be the cause of this? Is it an expected behavior? I'm assuming this is not a successful login.
Here is the returned xml:
<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<ns21:getSiteRefreshInfoResponse xmlns:ns21="http://refresh.refresh.core.soap.yodlee.com">
<getSiteRefreshInfoReturn><siteRefreshStatus>LOGIN_FAILURE</siteRefreshStatus>
<siteRefreshMode>NORMAL_REFRESH_MODE</siteRefreshMode>
<code>0</code>
</getSiteRefreshInfoReturn>
</ns21:getSiteRefreshInfoResponse>
</soapenv:Body></soapenv:Envelope>
Thanks,
I contacted Yodlee Support and I got the answer that it is expected behaviour and users need to login again to get the instant refresh and refreshing sites should work again.

Bug (cache?) in WSO2 PDP when policy is created via Admin Services API

I created a demo to demonstrates a problem (cache?) in PDP API on WSO2 IS.
My demo creates a policy and two tests to validate, and result OK (first test PERMIT and second DENY)
On first run, the results are displayed correctly (OK).
Via Carbon web interface, I delete all policies in PAP (and PDP), and ran again my Python demo, and the result is wrong (two tests result DENY).
My demo (see the README file for environment and configuration details):
https://github.com/welkson/WSO2-PDP-CacheTest
I've tried to disable caching of WSO2, but had no effect.
Tested with WSO2 IS 5.3 and 5.4.0-alpha2.
Looks like its the same issue as that is reported
in https://wso2.org/jira/browse/IDENTITY-5603. I have increased the priority so that this will be addressed in the next immediate release.
You can follow up with JIRA for the the progress of the fix.
Possible Workaround:
Clear the cache using the EntitlementAdminService
https://localhost:9443/services/EntitlementService?wsdl
Follow [1] to get an idea on how to invoke admin services.
Request
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://org.apache.axis2/xsd">
<soapenv:Header/>
<soapenv:Body>
<xsd:clearPolicyCache/>
</soapenv:Body>
</soapenv:Envelope>
[1] https://docs.wso2.com/display/IS530/Entitlement+using+SOAP+Service

Reporting Services - getting data from https SOAP API

Is it possible to create a data source in reporting services to pull data from a https data source?
I have successfully managed to create reports that pull from various http SOAP APIs, but when I try to connect to a https data source I get an error.
The error coming back from the webservice is not very descriptive -
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><soap:Fault><faultcode>soap:Server</faultcode><faultstring>An error has occurred while consuming this service. Read the Detail property for further information.</faultstring><faultactor>GetExceptionPolicy</faultactor><detail>An error has occurred while consuming this service. Please contact your administrator for more information. Error ID: a90b9112-c09b-438d-b58b-4dfb852658ce</detail></soap:Fault></soap:Body></soap:Envelope>
The webservice I'm calling is logging the request that SSRS sent in a database, and it is storing it with a leading "?" -
?<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetBiller xmlns="http://tempuri.org">
<AgentID>1</AgentID>
</GetBiller>
</soap:Body>
</soap:Envelope>

Apache CXF JMS - SOAP

I need to use the same SOAP request to be able to call the same implementation of a method but which is exposed by 2 different service endpoints:
Endpoint A - would be for synchronous access via SOAP
Endpoint B - would be for asynchronous access via JMS
Now what am seeing is that the SOAP request Message which works on the JMS and the SOAP webservice endpoint are structurally different.
I wanted to know whether with ApacheCXF it is possible to call the SOAP or JMS endpoints using the same SOAP request ?
In my case I was able to call both endpoints but the requests used is not the same for each
Below is an example of the SOAP message which works on Asynch Endpoint B but which does not work on Synch Endpoint A .. note that I've obtained the Asynch message by executing a Junit test and intercepted the generate message on ActiveMQ queue:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns1:create xmlns:ns1="http://service.ws.example/">
<CustomPartyModel>
<ns2:customerModel
xmlns:ns2="http://party.beans.commons.example">
<ns2:person>
<ns2:budgetPlanNumber>131484</ns2:budgetPlanNumber>
<ns2:clientSituationCode
xmlns:ns3="http://www.w3.org/2001/XMLSchema-instance" ns3:nil="true" />
<ns2:employeeReduction>J</ns2:employeeReduction>
<ns2:employeeNumber></ns2:employeeNumber>
<ns2:packageNumber>5</ns2:packageNumber>
<ns2:planIndicator xmlns:ns3="http://www.w3.org/2001/XMLSchema-instance"
ns3:nil="true" />
<ns2:privateRelationNumber
xmlns:ns3="http://www.w3.org/2001/XMLSchema-instance" ns3:nil="true" />
</ns2:person>
</ns2:customerModel>
</CustomPartyModel>
</ns1:create>
</soap:Body>
Here is the SOAP Request which works on Synchronous endpoint but not on the Asynch one .. this request was obtained from creating a request from the WSDL :
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://service.ws.example/" xmlns:par="http://party.beans.commons.example">
<soapenv:Body>
<ser:CustomPartyModel>
<par:customerModel>
<par:person>
<par:budgetPlanNumber>131484</par:budgetPlanNumber>
<par:employeeReduction>J</par:employeeReduction>
<par:employeeNumber></par:employeeNumber>
<par:packageNumber>5</par:packageNumber>
<par:professionCodePartner></par:professionCodePartner>
<par:professionDescriptionPartner></par:professionDescriptionPartner>
</par:person>
</par:customerModel>
</ser:CustomPartyModel>
In both cases am using Aegis for data binding , I did try JAXB as well but with no futher success.
Given that its the same method with same method signature you would expect that the same request could be used in both asynch and synch but this does not seem to be the case .
Anybody has had similar issues or could possibly shed some light in regards to this ?
Note that am using the following dependencies:
cxf-api-2.2.2.jar ,
cxf-common-utilities-2.2.2.jar,
cxf-rt-databinding-aegis-2.2.2.jar,
XmlSchema-1.4.5.jar,
cxf-rt-transports-jms-2.2.2.jar,
spring-jms-2.5.5.jar,
acegi-security-1.0.7.jar
Ok I found the solution basically to be able to send Request through JMS and Synchronous SOAP as Document Literal the following is required to be defined on the interface
#WebService
#SOAPBinding(style=Style.DOCUMENT, use=Use.LITERAL,parameterStyle=ParameterStyle.BARE)
public interface ExampleAsyncService {
Without the Document / Literal / Bare configuration JMS will have a tendancy of sending RPC wrapped style request .