WCF binding configuration for SalesForce Api - wcf

For an application i'm developing i need to make a call on the SalesForce api. With SvcUtil i generated a proxy and integrated this in my solution. After i made a call via code, i get the following request and exception response. I use a normal basicHttpBinding.
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none"></Action>
<VsDebuggerCausalityData xmlns="http://schemas.microsoft.com/vstudio/diagnostics/servicemodelsink"></VsDebuggerCausalityData>
</s:Header>
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<login xmlns="urn:partner.soap.sforce.com">
<username>XXX</username>
<password>XXX</password>
</login>
</s:Body>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"></s:Header>
<soapenv:Body>
<soapenv:Fault>
<faultcode xmlns="">soapenv:Client</faultcode>
<faultstring xmlns="">No operation available for request {urn:partner.soap.sforce.com}login</faultstring>
</soapenv:Fault>
</soapenv:Body>
However, if call the service with SoapUI, i don't get any errors. After googling i tried to make some changes in the binding and created a custom binding for forcing the soap version to 1.2, but didn't find a good solution. What should i change in the binding configuration?
This is the SoapUI call:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:partner.soap.sforce.com">
<soapenv:Body>
<urn:login>
<urn:username>XXXX</urn:username>
<urn:password>XXXX</urn:password>
</urn:login>
</soapenv:Body>
</soapenv:Envelope>

After some research i found out that creating a proxy using "Add service reference" creates a proxy that works. So my problem is solved. Still have to check what the difference is between the generated proxies.

Related

Sonos applink based authentication issue

Trying to add out sonos service will show Authorize" screen for a fraction of a second before it goes away stating "account not found" before I even have time to put in an account. Below are the request for applink and resonse.
Any thing else is required to make it remain in the authorize screen
//request
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.sonos.com/Services/1.1">
<soapenv:Header>
<ns:context>
</ns:context>
<ns:credentials>
</ns:credentials>
</soapenv:Header>
<soapenv:Body>
<ns:getAppLink>
<ns:householdId>Sonos_ghsAflSonosakevCzmxcmFhN7pN</ns:householdId>
<ns:hardware>iPhone8,2</ns:hardware>
<ns:osVersion>Version 9.3.3 (Build 13G34)</ns:osVersion>
<ns:sonosAppName>ICRU_iPhone8,2</ns:sonosAppName>
<ns:callbackPath>sonos://x-callback-url/addAccount?state=sid%3D61703%26OAuthDeviceID%3DSonos_ghsAflSonosakevCzmxcmFhN7pN%26callbackPath%3D%2FaddAccount</ns:callbackPath>
</ns:getAppLink>
</soapenv:Body>
</soapenv:Envelope>
//response
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tns="http://www.sonos.com/Services/1.1">
<soap:Body>
<getAppLinkResponse xmlns="http://www.sonos.com/Services/1.1">
<getAppLinkResult>
<authorizeAccount>
<appUrlStringId>LAUNCH_APP</appUrlStringId>
<deviceLink>
<regUrl>https://ourserver.com/#/signin?callbackurl=sonos://x-callback-url/add…
<linkCode>Sonos_ghsAflSonosakevCzmxcmFhN7pN</linkCode>
<showLinkCode>false</showLinkCode>
</deviceLink>
</authorizeAccount>
</getAppLinkResult>
</getAppLinkResponse>
</soap:Body>
</soap:Envelope>
The experience you are describing is what would happen if you are not properly returning the ‘NOT_LINKED_RETRY’ fault.
As described in the documentation, https://musicpartners.sonos.com/node/405 (search for polling). While your service waits for the user to manually log in through the browser, it should provide to the getDeviceAuthToken call the ‘NOT_LINKED_RETRY’ fault response for a few minutes. Details for this fault can be found here: https://musicpartners.sonos.com/node/292.

SOAP Request to local WCF Service results in "InvalidSecurity Error"

We've got a WCF service with BasicHttpBinding and tested it via SoapUI.
My co-worker can post the requests just fine, but on my machine I get the following error returned:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<s:Fault>
<faultcode xmlns:a="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">a:InvalidSecurity</faultcode>
<faultstring xml:lang="de-AT">The caller was not authenticated by the service.</faultstring>
</s:Fault>
</s:Body>
</s:Envelope>
I'm pretty clueless as to why it doesn't work on my machine. IIS Settings are the same, too. A typical "It works on MY machine!" problem...

SOAP Action mismatch error while testing a WCF service with SoapUI

Am testing a WCF service with a sample input in SOAPUI. when i hit the run,I get an SOAP Exception like below:
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
<s:Header>
<a:Action s:mustUnderstand="1">http://www.w3.org/2005/08/addressing/fault</a:Action>
</s:Header>
<s:Body>
<s:Fault>
<s:Code>
<s:Value>s:Sender</s:Value>
<s:Subcode>
<s:Value>a:ActionMismatch</s:Value>
</s:Subcode>
</s:Code>
<s:Reason>
<s:Text xml:lang="en-US">The SOAP action specified on the message, '', does not match the HTTP SOAP Action, 'http://XXX.XX.XXXX/IXXXXXX/AddOrderInfromation'.</s:Text>
</s:Reason>
<s:Detail>
<a:ProblemHeaderQName>a:Action</a:ProblemHeaderQName>
</s:Detail>
</s:Fault>
</s:Body>
</s:Envelope>
In blogs, they are asking to add Soap Action . How to Add Soap Action in my request below:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:wkus="http://XXX.XX.XXXX/IXXXXXX">
<soap:Header />
<soap:Body>
<ns1:AddOrderInfromation>
<!--Optional:-->
<ns1:inputsting>
<ns1:AddOrderInfromation>
<ns1:OrderNo>4500146</ns1:OrderNo>
<ns1:OrderDate>08/22/2014</ns1:OrderDate>
<ns1:TotalItems>1</ns1:TotalItems>
</ns1:AddOrderInfromation>
</ns1:inputsting>
</ns1:AddOrderInfromation>
Please Suggest. Thanks in Advance
This is probably a WS-A addressing issue.
In the WS-A tab of your Request, check Enable WS-A addressing.
You may also have to check Add default was:To.
Your web service is returning a SOAPFault which is saying that web service expects a SOAP Action http header. In order to add a SOAP action in your SOAP request from SOAPUI you must add a http header named SOAPAction, to do so do the next step:
In the bottom of your SOAP test request there are some tabs (Header(0), Attachments(0)...), open the Header(0) tab.Then using + add button, add a header with SOAPAction name and your value:
hope this helps,
I had this problem too, and solved it by enabling WS-A addressing in SopaUI.
screenshot from SoapUI
This error also occurs due to improper syntax in xml request
For Eg : It will throw same error if
closing tag is missing
</soap:Body>
</soap:Envelope>
in below code
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:wkus="http://XXX.XX.XXXX/IXXXXXX">
<soap:Header />
<soap:Body>
<ns1:AddOrderInfromation>
<ns1:inputsting>
<ns1:AddOrderInfromation>
<ns1:OrderNo>4500146</ns1:OrderNo>
<ns1:OrderDate>08/22/2014</ns1:OrderDate>
<ns1:TotalItems>1</ns1:TotalItems>
</ns1:AddOrderInfromation>
</ns1:inputsting>
</ns1:AddOrderInfromation>
or if having unexpected syntax like this
<ns1:OrderNo>4500146**<ns1:OrderNo>**
instead of
<ns1:OrderNo>4500146**</ns1:OrderNo>**
or this
<ns1:**OrderNo**4500146</ns1:OrderNo>
instead of
<ns1:**OrderNo>**4500146</ns1:OrderNo>
I have just encountered similar problem. And I solved the issue like below;
https://blabla.com/xyz.svc?wsdl -->go to the wsdl url on browser and you will see some actions inside methods;
I use python for development and i added soapAction like below;
headers = {'Content-type': 'text/xml;charset=UTF-8',
'SOAPAction': 'http://tempuri.org/IArasCargoIntegrationService/GetQueryXML'
}
and it worked.

How to solve the "cannot find soap action mapping for" soap api?

The request for soap api is given below
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:WashOut"
<soapenv:Header/>
<soapenv:Body>
<urn:Activate_VAS_Request soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<OPER_NAME xsi:type="xsd:string">?</OPER_NAME>
<OPER_PASSWORD xsi:type="xsd:string">?</OPER_PASSWORD>
<MSISDN xsi:type="xsd:string">?</MSISDN>
<VAS_ID xsi:type="xsd:int">?</VAS_ID>
<PARAM_VAL xsi:type="xsd:string">?</PARAM_VAL>
</urn:Activate_VAS_Request>
</soapenv:Body>
</soapenv:Envelope>
and the response of the request is given below.
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
<soap:Fault encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<faultcode xsi:type="xsd:QName">Server</faultcode>
<faultstring xsi:type="xsd:string">Cannot find SOAP action mapping for</faultstring>
</soap:Fault>
</soap:Body>
</soap:Envelope>
which thing causing the error.
This error means WashOut is unable to find the requested action (in your particular case it fails to even parse it – it's empty string).
Also the wash_out version you use is critically old. Current one is 0.9.0. Please upgrade.
I've seen that some Soap clients send the request in a way wash_out can't infer the soapAction value, as a consequence it can't link the request to an action in the wash_out controller.
For having a working reference, I think you should try a soap client such as soapUI or Savon, I've seen they send the request in a way wash_out can infer which is the soapAction in the request.

SoapUI get response but not the .Net Client

I am trying to access a https Java webservice from .net client but always end up with "504 Gateway Timeout" exception.
I could get the response from the same webservice using SoapUI.
I also noticed that the request soap message of SoapUI and .net client aren't similar. My question is, does the wrong format of message gives the "504 Gateway Timeout" problem ? if yest, How could i modify the soap message in .net client?
Here are the request soap message that two different app generates:
SoapUI
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="http://company.domain.com/EchoService/v1_00">
<soapenv:Header/>
<soapenv:Body>
<v1:Echo>test</v1:Echo>
</soapenv:Body>
</soapenv:Envelope>
.NET client
{<s:Envelope xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:s="http://www.w3.org/2003/05/soap-envelope">
<s:Header>
<a:Action s:mustUnderstand="1">Echo</a:Action>
<a:MessageID>urn:uuid:7a76925d-5bf0-4f2d-a9c5-c5a026e1eefb</a:MessageID>
<a:ReplyTo>
<a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
</a:ReplyTo>
</s:Header>
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Echo xmlns="http://company.domain.com/EchoService/v1_00">test</Echo>
</s:Body>
</s:Envelope>}
sorry, folks nothing to do with wcf binding or soap message but the proxy was blocking the request. SoapUI could send/receive the message because it doesn't use proxy. just changed useDefaultWebProxy="false" in binding section of configuration.