Paypal ManagePendingTransactionStatus method returning error - asp.net

I'm trying to cancel a pending transaction via PayPal's Classic API (SOAP) using the ManagePendingTransactionStatus method, but the response is always an internal error. I have already tried to change the Action, DetailLevel, Version, and I've used various (existing) TransactionIDs, but nothing worked.
Have someone passed through something alike? Is there some configuration I'm missing?
I'm using the sandbox environment, from my ASP.NET WebForms (framework version 4.5) app, within my localhost on Windows 7 x64. Here are the request content:
URL: https://api-3t.sandbox.paypal.com/2.0/
Request:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cc="urn:ebay:apis:CoreComponentTypes" xmlns:ebl="urn:ebay:apis:eBLBaseComponents" xmlns:ed="urn:ebay:apis:EnhancedDataTypes" xmlns:ns="urn:ebay:api:PayPalAPI">
<soapenv:Header>
<ns:RequesterCredentials>
<ebl:Credentials>
<ebl:Username>correct.username</ebl:Username>
<ebl:Password>correct.password</ebl:Password>
<ebl:Signature>Correct.Signature</ebl:Signature>
</ebl:Credentials>
</ns:RequesterCredentials>
</soapenv:Header>
<soapenv:Body>
<ns:ManagePendingTransactionStatusReq>
<ns:ManagePendingTransactionStatusRequest>
<ebl:Version>104.0</ebl:Version>
<ns:TransactionID>3B880366F0154954J</ns:TransactionID>
<ns:Action>Deny</ns:Action>
</ns:ManagePendingTransactionStatusRequest>
</ns:ManagePendingTransactionStatusReq>
</soapenv:Body>
</soapenv:Envelope>
Response:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:cc="urn:ebay:apis:CoreComponentTypes" xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility" xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/12/secext" xmlns:ed="urn:ebay:apis:EnhancedDataTypes" xmlns:ebl="urn:ebay:apis:eBLBaseComponents" xmlns:ns="urn:ebay:api:PayPalAPI">
<SOAP-ENV:Header>
<Security xmlns="http://schemas.xmlsoap.org/ws/2002/12/secext" xsi:type="wsse:SecurityType"></Security>
<RequesterCredentials xmlns="urn:ebay:api:PayPalAPI" xsi:type="ebl:CustomSecurityHeaderType">
<Credentials xmlns="urn:ebay:apis:eBLBaseComponents" xsi:type="ebl:UserIdPasswordType">
<Username xsi:type="xs:string"></Username>
<Password xsi:type="xs:string"></Password>
<Signature xsi:type="xs:string"></Signature>
<Subject xsi:type="xs:string"></Subject>
</Credentials>
</RequesterCredentials>
</SOAP-ENV:Header>
<SOAP-ENV:Body id="_0">
<ManagePendingTransactionStatusResponse xmlns="urn:ebay:api:PayPalAPI">
<Timestamp xmlns="urn:ebay:apis:eBLBaseComponents">2014-05-28T14:27:44Z</Timestamp>
<Ack xmlns="urn:ebay:apis:eBLBaseComponents">Failure</Ack>
<CorrelationID xmlns="urn:ebay:apis:eBLBaseComponents">1c49de851e39e</CorrelationID>
<Errors xmlns="urn:ebay:apis:eBLBaseComponents" xsi:type="ebl:ErrorType">
<ShortMessage xsi:type="xs:string">Internal Error</ShortMessage>
<LongMessage xsi:type="xs:string">Internal Error</LongMessage>
<ErrorCode xsi:type="xs:token">10001</ErrorCode>
<SeverityCode xmlns="urn:ebay:apis:eBLBaseComponents">Error</SeverityCode>
</Errors>
<Version xmlns="urn:ebay:apis:eBLBaseComponents">104.0</Version>
<Build xmlns="urn:ebay:apis:eBLBaseComponents">10958405</Build>
<TransactionID xsi:type="xs:string">3B880366F0154954J</TransactionID>
<Status xsi:type="xs:string">The Status of the transaction after running the your action (accept/deny) is:Unable To Determine</Status>
</ManagePendingTransactionStatusResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

According to the documentation, The ManagePendingTransactionStatus API operation accepts or denys a pending transaction held by Fraud Management Filters. If it is pending for any other reason the operation will likely produce an error.

Related

How can i change/edit SOAP response in ASMX

Im creating a soap web service for our client and I need to change the response from:
<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>
<send_messageResponse xmlns="send_message_response">
<message_response>
<message_id>2001</message_id>
<description>sent</description>
<status>sent</status>
</message_response>
</send_messageResponse>
</soap:Body>
</soap:Envelope>
to
<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>
<send_message_response xmlns="send_message_response">
<message_response>
<message_id>2001</message_id>
<description>sent</description>
<status>sent</status>
</message_response>
</send_messageResponse>
</soap:Body>
</soap:Envelope>
i've tried adding
[WebMethod]
[return: XmlElement("message_response")]
[SoapDocumentMethod("send_message", RequestNamespace = "urn", ResponseNamespace = "send_message_response", Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
but still cant change the response. im also wondering if any have experience in creating the Outbound API of Oracle Field Service Cloud? Coz our client is oracle :)

WCF call to SOAP web service successfull but the client method returns Nothing

I am trying to consume a Java web service that is on our intranet. I added a Service Reference to my client project and I am able to successfully make calls and by using Fiddler I am able to see the successfull SOAP response from the service but the method generated by WCF is returning Nothing. After many days of researching, the most common fault I found is a mismatch on the namespace of the response. So I modified the WSDL and recreated the reference but the method still returns Nothing. I don't know what else to look for.
Here is the auto-generated response class from the WSDL file.
<System.Diagnostics.DebuggerStepThroughAttribute(), _
System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0"), _
System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced), _
System.ServiceModel.MessageContractAttribute(WrapperName:="terminateCredentialRecordBySSNResponse", WrapperNamespace:="service.credential.epecs", IsWrapped:=true)> _
Partial Public Class terminateCredentialRecordBySSNResponse
<System.ServiceModel.MessageBodyMemberAttribute([Namespace]:="service.credential.epecs", Order:=0, Name:="return"), _
System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True)> _
Public [return] As EpecsCredServ.[return]
Public Sub New()
MyBase.New
End Sub
Public Sub New(ByVal [return] As EpecsCredServ.[return])
MyBase.New
Me.[return] = [return]
End Sub
End Class
Here is the client code:
Dim ws As New EpecsCredentialServicePortTypeClient("EpecsCredentialServiceHttpSoap11Endpoint")
Dim wsparams As New params
With wsparams
.ssn = TextBox1.Text
.fascnPOA = "5"
.lModSSAPIN = "9e1365"
.credRevokeTrans = "css113655"
.credRevokeReason = "396"
.termActDate = Now.ToShortDateString
.credRevokeReasonOther = "css"
End With
Dim results As [return] = ws.terminateCredentialRecordBySSN(wsparams) '<== returns Nothing
If results IsNot Nothing Then
txtResponse.Text = results.status
End If
Endpoint configuration on my Web.config file:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="EpecsCredentialServiceSoap11Binding" />
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://xxx.xxx.xxx:80/axis2_epecs/services/EpecsCredentialService.EpecsCredentialServiceHttpSoap11Endpoint/"
binding="basicHttpBinding" bindingConfiguration="EpecsCredentialServiceSoap11Binding"
contract="EpecsCredServ.EpecsCredentialServicePortType" name="EpecsCredentialServiceHttpSoap11Endpoint">
<headers>
<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-4" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:Username>MYUSERNAME</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">MYPASSWORD</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</headers>
</endpoint>
</client>
</system.serviceModel>
The SOAP request sent as seen through Fiddler:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<ActivityId CorrelationId="c057bd17-4f9d-4f98-848e-e1ba8522727a" xmlns="http://schemas.microsoft.com/2004/09/ServiceModel/Diagnostics">ffc51799-9c34-43c2-bbac-9c49067f5f40</ActivityId>
<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-4" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:Username>MYUSERNAME</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">MYPASSWORD</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</s:Header>
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<terminateCredentialRecordBySSN xmlns="service.credential.epecs">
<params xmlns="">
<ssn>999999999</ssn>
<fascnPOA>5</fascnPOA>
<lModSSAPIN>9e1365</lModSSAPIN>
<credRevokeTrans>css113655</credRevokeTrans>
<credRevokeReason>396</credRevokeReason>
<termActDate>6/6/2014</termActDate>
<credRevokeReasonOther>css</credRevokeReasonOther>
</param
</terminateCredentialRecordBySSN>
</s:Body>
</s:Envelope>
And the SOAP response:
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<return xmlns="service.credential.epecs">
<status>-3</status>
<Credentials>
<credential>
<cred_uid>555558</cred_uid>
<cred_ssn>999999999</cred_ssn>
<cred_fascn_sc>0001</cred_fascn_sc>
<cred_fascn_cn>703608</cred_fascn_cn>
<cred_fascn_pi>1000702718</cred_fascn_pi>
<cred_dob>1975-03-12 00:00:00.0</cred_dob>
<cred_first_name>Demog</cred_first_name>
<cred_middle_name>C</cred_middle_name>
<cred_last_name>Rgstr</cred_last_name>
<cred_fascn_ici>1</cred_fascn_ici>
<cred_fascn_cs>1</cred_fascn_cs>
<cred_fascn_oc>1</cred_fascn_oc>
<cred_fascn_oi>2800</cred_fascn_oi>
<cred_fascn_poa>5</cred_fascn_poa>
<cred_fascn_b64>0gQQ2CEMLcDloRWhaFoBCHgUcgKCBBDX5w==</cred_fascn_b64>
<cred_fascn_ac>2800</cred_fascn_ac>
<cred_cert_profile>OBERTHUR_PIV_NOLOGICAL</cred_cert_profile>
<cred_status>44</cred_status>
<cred_sponsor_name>Max</cred_sponsor_name>
<cred_approval_transaction>EPECS9000007</cred_approval_transaction>
<cred_revoke_transaction>CSS20140425121200</cred_revoke_transaction>
<cred_term_code>396</cred_term_code>
<cred_reason_code>1</cred_reason_code>
<cred_pacs_badge_num>28000000000</cred_pacs_badge_num>
<cred_unqualified_cert_dn>cn=DemoRgstr (affiliate),ou=XXXXXXXX,ou=XXX,o=XXXXXX,c=US</cred_unqualified_cert_dn>
<cred_qualified_cert_dn>cn=Demo-Rgstr (affiliate) + dnQualifier=XXX,ou=XXXXXX,ou=XXX,o=XXXXXXXX,c=US</cred_qualified_cert_dn>
<cred_doors_code>AXX</cred_doors_code>
<cred_term_date>2014-04-25 00:00:00.0</cred_term_date>
<cred_mod_date>2014-04-25 15:14:12.0</cred_mod_date>
<cred_exp_date>2013-05-22 14:31:06.505941</cred_exp_date>
<cred_last_update_pin>9e1365</cred_last_update_pin>
<cred_last_update_date>2014-04-25 15:14:12.405946</cred_last_update_date>
<cred_term_code_other>CSS</cred_term_code_other>
</credential>
<credential />
</Credentials>
</return>
</soapenv:Body>
</soapenv:Envelope>
Thanks!
So, after trying for more than two weeks I decided to call the service using the HttpWebRequest class to build the request myself (example). After trying, it gave me a "401 - Unauthorized" error even though I was sending the Username/Password in the header. Turns out I needed to specify the credentials Network credentials like so:
proxy.Credentials = New System.Net.NetworkCredential(UserID, UserPassword)
Now I am getting the response back and ready to read.

405 status code not returning the response properly

I have an http method fault that executes when an incorrect http method is sent in the request.
when I set the status code as 405 ,the request returns a 502 bad gateway .
my fault is :
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<RaiseFault async="false" continueOnError="false" enabled="true" name="invalid-htttp-method-fault">
<DisplayName>invalid htttp method fault</DisplayName>
<FaultRules/>
<Properties/>
<FaultResponse>
<Set>
<Headers/>
<Payload contentType="application/xml">
<Fault>
<Code>405</Code>
<Description>Method Not Allowed</Description>
</Fault>
</Payload>
<StatusCode>405</StatusCode>
<ReasonPhrase>Method Not Allowed</ReasonPhrase>
</Set>
</FaultResponse>
<IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
</RaiseFault>
If I change
<StatusCode>405</StatusCode>
<ReasonPhrase>Method Not Allowed</ReasonPhrase>
to
<StatusCode>403</StatusCode>
<ReasonPhrase>Method Not Allowed</ReasonPhrase>
I can see the response payload is returned perfectly . when I use 405 the response returned is :
{"fault":{"faultstring":"Received 405 Response without Allow Header","detail":{"errorcode":"protocol.http.Response405WithoutAllowHeader"}}}
I was able to reproduce the exact issue that you are facing and by doing some more research I found that HTTP 405 response must include an Allow-Header
Try changing your fault policy by adding a header -
<Headers>
<Header name="Allow">YOUR ALLOWED METHODS LIST</Header>
</Headers>
By doing this you should no more be getting the 502 bad gateway and will get what you are expecting as a response.
I hope this helps.
Thanks!
Ah.... Interesting. Response 405 requires an Allow header per the HTTP spec (see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). So, the Apigee error is telling you that you need to add an Allow header to your FaultResponse like this:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<RaiseFault async="false" continueOnError="false" enabled="true" name="Fault-405">
<DisplayName>Fault 405</DisplayName>
<FaultRules/>
<Properties/>
<FaultResponse>
<Set>
<Headers>
<Header name="Allow">GET, PUT, POST, DELETE</Header>
</Headers>
<Payload contentType="text/plain">This wasn't supposed to happen</Payload>
<StatusCode>405</StatusCode>
<ReasonPhrase>405 Rules</ReasonPhrase>
</Set>
</FaultResponse>
<IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
</RaiseFault>
So add the Allow verbs in the <Set> block and you should be cool.

How to handle SOAP response in FLEX 3

SOAP Request<?xml version="1.0" encoding="UTF-8"?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Header/>
<S:Body>
<ns2:deleteDataView xmlns:ns2="http://ws.$$$$$.#####.####.com/">
<identifier>5</identifier>
</ns2:deleteDataView>
</S:Body>
</S:Envelope>
SOAP Response<?xml version="1.0" encoding="UTF-8"?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns2:deleteDataViewResponse xmlns:ns2="http://ws.$$$$$.#####.####.com/">
<return>ERROR: A bug has been encountered,please try later</return&gt
</ns2:deleteDataViewResponse>
</S:Body>
</S:Envelope>
I want to read SOAP response in flex,am some what new to FLEX,pls help,even good resources will work.
Handling SOAP Response
<mx:WebService
id="userRequest"
wsdl="http://www.gnpcb.org/esv/share/soap/index.php?wsdl">
<mx:operation name="doPassageQuery" resultFormat="object"
fault="mx.controls.Alert.show(event.fault.faultString)"
result="showResult(event)"/>
</mx:WebService>
In the above code you are accessing your SOAP WebService, now you have the resultFormat is an Object and the result function is showResult()
private function showResult(e:ResultEvent):void
{
trace(e.result);
}
Resources
http://www.flexlive.net/?p=79

How to get BinarySecurityToken into the wcf soap request

I need to sign my soap request to a 3rd party. The provided an example what the call should look like. And I am trying, rather unsuccessfully to make this call with wcf.
I need to make a wcf soap call where the header contains BinarySecurityToken, Signature, and SecurityTokenReference.
Here is the example they sent me (with some of the values omitted) I have a certificate for signing, but I cant for the life of me figure out how to make this work
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Header><wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:BinarySecurityToken EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" wsu:Id="SecurityToken-..omitted.." xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">..omitted..</wsse:BinarySecurityToken>
<ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:SignedInfo>
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
<ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
<ds:Reference URI="#Body">
<ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
</ds:Transforms>
<ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<ds:DigestValue>..omitted...</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
<ds:SignatureValue>
..omitted..
</ds:SignatureValue>
<ds:KeyInfo><wsse:SecurityTokenReference><wsse:Reference URI="#SecurityToken-..omitted.." ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3"/></wsse:SecurityTokenReference></ds:KeyInfo></ds:Signature></wsse:Security></soapenv:Header><soapenv:Body wsu:Id="Body"><in0 xmlns="http://test.3rdParty.com">123</in0></soapenv:Body></soapenv:Envelope>
We ended up with a hotfix from microsoft and few custom classes

Resources