Define WS-Addressing on PHP SOAP API request - api

I'm able to get successful response from wsdl if I enable WS-Addressing on SOAP UI. Wondering how to accomplish this using PHP. Here is my current XML request:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:bses="http://bsestarmf.in/">
<soap:Header/>
<soap:Body>
<bses:getPassword>
<!--Optional:-->
<bses:UserId>12345</bses:UserId>
<!--Optional:-->
<bses:Password>somepassword</bses:Password>
<!--Optional:-->
<bses:PassKey>somekey</bses:PassKey>
</bses:getPassword>
</soap:Body>
</soap:Envelope>
Here is my wsdl: http://bsestarmfdemo.bseindia.com/MFOrderEntry/MFOrder.svc?wsdl
I get this error response without enabling WS-Addressing:
<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://bsestarmf.in/MFOrderEntry/getPassword'.</s:Text>
</s:Reason>
<s:Detail>
<a:ProblemHeaderQName>a:Action</a:ProblemHeaderQName>
</s:Detail>
</s:Fault>
</s:Body>
</s:Envelope>

Related

Dynamics CRM SOAP Request : "Request is unsupported."

The Windows Live ID authentication we used to connect via SOAP to our Dynamics stopped working, after years without problem.
Here is the SOAP Request:
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"
xmlns:a="http://www.w3.org/2005/08/addressing"
xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<s:Header>
<a:Action s:mustUnderstand="1">
http://schemas.xmlsoap.org/ws/2005/02/trust/RST/Issue</a:Action>
<a:MessageID>urn:uuid:56476fb1-26d4-4525-a62a-4a1c65e71e85</a:MessageID>
<a:ReplyTo>
<a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
</a:ReplyTo>
<a:To s:mustUnderstand="1">
https://login.microsoftonline.com/extSTS.srf</a:To>
<o:Security s:mustUnderstand="1"
xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<u:Timestamp u:Id="_0">
<u:Created>2022-05-05T15:13:25.00Z</u:Created>
<u:Expires>2022-05-06T15:13:25.00Z</u:Expires>
</u:Timestamp>
<o:UsernameToken u:Id="devicesoftware">
<o:Username>user here</o:Username>
<o:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">password here</o:Password>
</o:UsernameToken>
</o:Security>
</s:Header>
<s:Body>
<t:RequestSecurityToken xmlns:t="http://schemas.xmlsoap.org/ws/2005/02/trust">
<wsp:AppliesTo xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
<a:EndpointReference>
<a:Address>http://passport.net/tb</a:Address>
</a:EndpointReference>
</wsp:AppliesTo>
<t:RequestType>
http://schemas.xmlsoap.org/ws/2005/02/trust/Issue</t:RequestType>
</t:RequestSecurityToken>
</s:Body>
</s:Envelope>`
And here is the answer :
<?xml version="1.0" encoding="utf-8"?><S:Envelope xmlns:wsa="http://www.w3.org/2005/08/addressing" 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:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wst="http://schemas.xmlsoap.org/ws/2005/02/trust" xmlns:S="http://www.w3.org/2003/05/soap-envelope"><S:Header><psf:pp xmlns:psf="http://schemas.microsoft.com/Passport/SoapServices/SOAPFault"><psf:serverVersion>1</psf:serverVersion><psf:authstate>0x80048800</psf:authstate><psf:reqstatus>0x80048800</psf:reqstatus><psf:serverInfo ServerTime="2022-05-05T14:54:49.1744415Z">ESTS-PUB-NEULR2-AZ1-FD071-001.ProdSlices rid:f2378b15-e610-4168-a77e-8572e61ba900</psf:serverInfo></psf:pp></S:Header><S:Body xmlns:S="http://www.w3.org/2003/05/soap-envelope"><S:Fault><S:Code><S:Value>S:Sender</S:Value><S:Subcode><S:Value>wst:FailedAuthentication</S:Value></S:Subcode></S:Code><S:Reason><S:Text xml:lang="en-US">Authentication Failure</S:Text></S:Reason><S:Detail><psf:error xmlns:psf="http://schemas.microsoft.com/Passport/SoapServices/SOAPFault"><psf:value>0x80048800</psf:value><psf:internalerror><psf:code>0x80048800</psf:code><psf:text>AADSTS90083: Request is unsupported.</psf:text></psf:internalerror></psf:error></S:Detail></S:Fault></S:Body></S:Envelope>
What could have gone wrong please ?
As #Guido Mentions in the comments.
You need to shift over to passing a JWT token now.. Dataverse has not supported LiveID since 2017, so I assume your using WS-TRUST there :)
That said, if your handcrafting calls to Dataverse, you should be using the WebAPI.
if you're using .net. You can use the CrmServiceClient or DataverseServiceClient(cross platform) to connect to and interact with Dataverse.
You can find more information here: https://learn.microsoft.com/en-us/power-apps/developer/data-platform/authenticate-office365-deprecation

How to write SQL inside XML SOAP request - salesforce marketing cloud API

I am new to SOAP.
I am trying to get the Send Object information and I am able to pull all the data I need except
SendID
This is the request I make in postman
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header>
<fueloauth>{{sf_ps_access_token}}</fueloauth>
</soapenv:Header>
<soapenv:Body>
<RetrieveRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
<RetrieveRequest>
<ObjectType>Send</ObjectType>
<Properties>ID</Properties>
<Properties>BCCEmail</Properties>
<Properties>SendID</Properties>
<Properties>Client.PartnerClientKey</Properties>
<Properties>PartnerKey</Properties>
<Properties>CreatedDate</Properties>
<Properties>ModifiedDate</Properties>
<Properties>Client.ID</Properties>
<Properties>Email.ID</Properties>
<Properties>Email.PartnerKey</Properties>
<Properties>SendDate</Properties>
<Properties>FromAddress</Properties>
<Properties>FromName</Properties>
<Properties>Duplicates</Properties>
<Properties>InvalidAddresses</Properties>
<Properties>HardBounces</Properties>
<Properties>SoftBounces</Properties>
<Properties>OtherBounces</Properties>
<Properties>ForwardedEmails</Properties>
<Properties>UniqueClicks</Properties>
<Properties>UniqueOpens</Properties>
<Properties>NumberSent</Properties>
<Properties>NumberDelivered</Properties>
<Properties>NumberTargeted</Properties>
<Properties>NumberErrored</Properties>
<Properties>NumberExcluded</Properties>
<Properties>Unsubscribes</Properties>
<Properties>MissingAddresses</Properties>
<Properties>Subject</Properties>
<Properties>PreviewURL</Properties>
<Properties>SentDate</Properties>
<Properties>EmailName</Properties>
<Properties>Status</Properties>
<Properties>EmailSendDefinition.ObjectID</Properties>
<Properties>EmailSendDefinition.CustomerKey</Properties>
<Properties>Client.PartnerClientKey</Properties>
<Properties>Email.PartnerKey</Properties>
<Filter xsi:type="ns1:SimpleFilterPart" xmlns:ns1="http://exacttarget.com/wsdl/partnerAPI">
<Property>CreatedDate</Property>
<SimpleOperator>between</SimpleOperator>
<DateValue>2018-01-01</DateValue>
<DateValue>2021-12-09</DateValue>
</Filter>
</RetrieveRequest>
</RetrieveRequestMsg>
</soapenv:Body>
</soapenv:Envelope>
This is the error I am getting:
Error: Column 'dbo.tblJobs.SendID' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause
How do I write SQL inside the xml SOAP request?
My response on this one is late. I think the problem is ,
In Send object (<ObjectType>Send</ObjectType>) there is no field as SendID. If you need Job Id inorder to connect other tracking, you need to use "ID" attribute. You can further improve using BatchId
SendID is present in other event like clicks or open. You can use SendId in those event for filtering the data
Sample message for getting send info :
<?xml version="1.0" encoding="UTF-8"?>
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<s:Header>
<a:Action s:mustUnderstand="1">Retrieve</a:Action>
<a:To s:mustUnderstand="1">https://{{et_subdomain}}.soap.marketingcloudapis.com/Service.asmx</a:To>
<fueloauth xmlns="http://exacttarget.com">{{AccessToken}}</fueloauth>
</s:Header>
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<RetrieveRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
<Options>
</Options>
<RetrieveRequest>
<ObjectType>Send</ObjectType>
<Properties>Client.ID</Properties>
<Properties>Email.ID</Properties>
<Properties>EmailName</Properties>
<Properties>Subject</Properties>
<Properties>SendDate</Properties>
<Properties>CreatedDate</Properties>
<Properties>Status</Properties>
<Properties>FromAddress</Properties>
<Properties>FromName</Properties>
<Properties>ID</Properties>
<Properties>NumberSent</Properties>
<Properties>NumberDelivered</Properties>
<Properties>ForwardedEmails</Properties>
<Properties>NumberErrored</Properties>
<Properties>NumberExcluded</Properties>
<Properties>ExistingUndeliverables</Properties>
<Properties>ExistingUnsubscribes</Properties>
<Properties>SoftBounces</Properties>
<Properties>HardBounces</Properties>
<Properties>OtherBounces</Properties>
<Properties>Unsubscribes</Properties>
<Properties>UniqueOpens</Properties>
<Properties>UniqueClicks</Properties>
<Properties>PreviewURL</Properties>
<Filter xsi:type="ns1:SimpleFilterPart" xmlns:ns1="http://exacttarget.com/wsdl/partnerAPI">
<Property>ID</Property>
<SimpleOperator>between</SimpleOperator>
<Value>1</Value><Value>10000</Value>
</Filter>
</RetrieveRequest>
</RetrieveRequestMsg>
</s:Body>
</s:Envelope>
Once you have the JobId(ID) from above , you can use it to get other tracking .
Using the job Id to get all related sent tracking :
<?xml version="1.0" encoding="UTF-8"?>
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<s:Header>
<a:Action s:mustUnderstand="1">Retrieve</a:Action>
<a:To s:mustUnderstand="1">https://{{et_subdomain}}.soap.marketingcloudapis.com/Service.asmx</a:To>
<fueloauth xmlns="http://exacttarget.com">{{AccessToken}}</fueloauth>
</s:Header>
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<RetrieveRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
<Options>
</Options>
<RetrieveRequest>
<ObjectType>SentEvent</ObjectType>
<Properties>Client.ID</Properties>
<Properties>SubscriberKey</Properties>
<Properties>EventDate</Properties>
<Properties>SendID</Properties>
<Properties>BatchID</Properties>
<Filter xsi:type="ns1:SimpleFilterPart" xmlns:ns1="http://exacttarget.com/wsdl/partnerAPI">
<Property>SendID</Property>
<SimpleOperator>between</SimpleOperator>
<Value>1</Value><Value>9000</Value>
</Filter>
</RetrieveRequest>
</RetrieveRequestMsg>
</s:Body>
</s:Envelope>

(Wso2 Api Manager 2.6.0) How to send a list of string as input using mediator?

(Wso2 Api Manager 2.6.0) How to send a list of string as input using mediator?
I have a Api and my api have a list of string for input.
my api is soap.
I think mediator can help me.
I want a mediator for this api.
for example this is my input:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/" xmlns:arr="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<soapenv:Header/>
<soapenv:Body>
<tem:GetData>
<!--Optional:-->
<tem:value>
<!--Zero or more repetitions:-->
<arr:string>a</arr:string>
<arr:string>s</arr:string>
<arr:string>f</arr:string>
</tem:value>
</tem:GetData>
</soapenv:Body>
</soapenv:Envelope>
and this is my output
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<GetDataResponse xmlns="http://tempuri.org/">
<GetDataResult>You entered: a s f</GetDataResult>
</GetDataResponse>
</s:Body>
</s:Envelope>

SQL Parse soap xml and show as a string

I am trying to return the ErrorReason from the below soap xml response. However it keeps returning empty. I am not sure how to handle the namespace.
I expect to return "The specified envelope has duplicate recipients."
declare #xml xml =
(
'<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" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" 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">
<soap:Header>
<wsa:Action>http://schemas.xmlsoap.org/ws/2004/08/addressing/fault</wsa:Action>
<wsa:MessageID>urn:uuid:b0c43031-35b9-40a1-a217-36491cfdd07c</wsa:MessageID>
<wsa:RelatesTo>urn:uuid:4871a441-ea1e-4f9b-953b-d3f426674597</wsa:RelatesTo>
<wsa:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:To>
<wsse:Security>
<wsu:Timestamp wsu:Id="Timestamp-c41a3e0c-317d-46e2-b203-6a0a43450313">
<wsu:Created>2017-08-31T18:11:00Z</wsu:Created>
<wsu:Expires>2017-08-31T18:16:00Z</wsu:Expires>
</wsu:Timestamp>
</wsse:Security>
</soap:Header>
<soap:Body>
<soap:Fault>
<faultcode>soap:Client</faultcode>
<faultstring>The specified envelope has duplicate recipients. </faultstring>
<faultactor>https://www.test.asmx</faultactor>
<detail>
<ErrorCode xmlns="missing in Web.Config">140</ErrorCode>
<ErrorReason xmlns="missing in Web.Config">The specified envelope has duplicate recipients.</ErrorReason>
</detail>
</soap:Fault>
</soap:Body>
</soap:Envelope>'
)
select x.value('ErrorReason[1]','VARCHAR(max)') from #xml.nodes('/*:Envelope/*:Body/detail') as X(x)
you want the below query
select #xml.query('/*:Envelope/*:Body/*:Fault/*:detail/*:ErrorReason/text()')

Why does .NET XMLSerializer automatically change my namespace prefixes (alias)?

I am working on a web service that needs to return faults in a way that is defined by the standards of our type of business. This requires me to return a fault as this:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<wsse:Security xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<Timestamp xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" />
</wsse:Security>
</soap:Header>
<soap:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Fault>
<faultcode>s:Server</faultcode>
<faultstring>Operator/operand type mismatch.</faultstring>
<faultactor>urn:dealernumberID:??????</faultactor>
<detail>
<ErrorType xmlns="http://www.starstandards.org/webservices/2009/transport">Backend Client Fault</ErrorType>
<ErrorDetail xmlns="http://www.starstandards.org/webservices/2009/transport">Backend client returned a fault</ErrorDetail>
</detail>
</soap:Fault>
</soap:Body>
</soap:Envelope>
I create the fault like this, but when the service sends it, it looks like this:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<h:Security xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:h="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<Timestamp xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" />
</h:Security>
</s:Header>
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<s:Fault>
<faultcode>s:Server</faultcode>
<faultstring>Operator/operand type mismatch.</faultstring>
<faultactor>urn:dealernumberID:??????</faultactor>
<detail>
<ErrorType xmlns="http://www.starstandards.org/webservices/2009/transport">Backend Client Fault</ErrorType>
<ErrorDetail xmlns="http://www.starstandards.org/webservices/2009/transport">Backend client returned a fault</ErrorDetail>
</detail>
</s:Fault>
</s:Body>
</s:Envelope>
Why does this happen? Is there a setting that I can change in .NET to keep it from doing this by default? I do understand that a namespace is a namespace regardless of the prefix, but like I said, the standard dictates we do it a certain way (most likely to accommodate third parties that are reading responses as strings?)
Thanks for any help!