Request to web services failed using php, succeeded from windows client - soap

I have written a web service using asp.net 2.0 and a simple method "HelloWorld" to test it. Here is the soap envelope which the server receives:
<?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:Header>
<SoapAuthHeader xmlns="http://myservice.anywhere.net/">
<UserName>MyUser</UserName>
<Password>MyPassword</Password>
</SoapAuthHeader>
</soap:Header>
<soap:Body>
<HelloWorld xmlns="http://myservice.anywhere.net/">
<request>
<?xml version="1.0" encoding="utf-16"?>
<HelloWorld />
</request>
</HelloWorld>
</soap:Body>
</soap:Envelope>
My Problem is: If I send the request from a Windows Client with embedded wsdl it succeeds. If I send the request from php (or SoapUI) the request fails - the server gets no "request" string, means no content for the body.
The server receives in both cases the same soap envelope above (logged it with a trace extension).
Thanks for any help.
Harald
P.S. No matter if I use embedded XML or embedded string for the request.

Using the asmx trace I have found the problem at least with SoapUI. The requested requirement category was "text/xml" and it got "application/soap+xml". I have disabled "Soap action" and the call succeeds.

Related

Get folder List for a particular email using GetFolder operation from Exchange Web Service using SOAP Message

I am using SOAPUI for my test. We have a service account linked to multiple inboxes. I am using GetFolder Operation of Exchange Web Services, specifying the request Header with Email ID. It seems like EWS is ignoring the provided email ID into the Soap header and only returning default inbox (I am supplying shared inbox in the header, connected to service account that is being used in authentication).
Kindly help to identify of my request is correct or Do i need to specify some flag to make sure my share inbox is accessible from my request?
Here is the sample request.
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<soap:Header>
<t:ConnectingSID>
<!--You have a CHOICE of the next 4 items at this level-->
<t:PrincipalName>mysharedinbox#mydomain.com</t:PrincipalName>
<t:PrimarySmtpAddress>mysharedinbox#mydomain.com</t:PrimarySmtpAddress>
<t:SmtpAddress>mysharedinbox#mydomain.com</t:SmtpAddress>
</t:ConnectingSID>
</soap:Header>
<soap:Body>
<FindFolder Traversal="Shallow" xmlns="http://schemas.microsoft.com/exchange/services/2006/messages">
<FolderShape>
<t:BaseShape>Default</t:BaseShape>
</FolderShape>
<ParentFolderIds>
<t:DistinguishedFolderId Id="msgfolderroot"/>
</ParentFolderIds>
</FindFolder>
</soap:Body>
</soap:Envelope>
If the service account has access to the Mailbox in question then you need to use the Mailbox child node of DistinguishedFolderId to specify the Mailbox you want to access eg
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<t:RequestServerVersion Version="Exchange2013" />
</soap:Header>
<soap:Body>
<m:GetFolder>
<m:FolderShape>
<t:BaseShape>AllProperties</t:BaseShape>
</m:FolderShape>
<m:FolderIds>
<t:DistinguishedFolderId Id="inbox"><t:Mailbox><t:EmailAddress>mailbox#domain.com</t:EmailAddress></t:Mailbox></t:DistinguishedFolderId>
</m:FolderIds>
</m:GetFolder>
</soap:Body>
</soap:Envelope>
The only time you would use ConnectingSID is when your using EWS impersonation (where you have those rights) and your impersonation header should look like
<soap:Header>
<t:ExchangeImpersonation>
<t:ConnectingSID>
<t:PrimarySmtpAddress>alisa#contoso.com</t:PrimarySmtpAddress>
</t:ConnectingSID>
</t:ExchangeImpersonation>
</soap:Header>

Response body not showing in Katalon Studio

I have started to use Katalon Studio for my Automated Tests. I am sending SOAP request and getting response status but unfortunately cannot see the response body in the Katalon Studio. Is there any way that I can see the response body?
You can see screenshot from here
Try with this. I referred here (http://www.dneonline.com/calculator.asmx?op=Add). I am getting the response body.
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<Add xmlns="http://tempuri.org/">
<intA>2</intA>
<intB>3</intB>
</Add>
</soap:Body>
</soap:Envelope>

EWS request fails because not Internet

I am calling EWS service on internal network which has not access to Internet.
I can open EWS url with browser and verify that it is up an running.
But when I try to send the SOAP request.
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<t:RequestServerVersion Version="Exchange2007_SP1" />
</soap:Header>
<soap:Body>
<m:GetFolder>
<m:FolderShape>
<t:BaseShape>IdOnly</t:BaseShape>
</m:FolderShape>
<m:FolderIds>
<t:DistinguishedFolderId Id="calendar" />
</m:FolderIds>
</m:GetFolder>
</soap:Body>
</soap:Envelope>
It fails with error ENOTFOUD. I am assuming that it can not connect to given address in the SOAP xml for schema definitions.
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
How to deal with this when there is no internet connection.
I am sending request from meteor.js app using lather.js library.
The stuff that looks like URL:s, prefixed with xmlns, are just name spaces and shall not be called. A bit like namespaces in a java program (for example namespace com.sun.something) is not an url you can call.
You should just do a http POST and send the entire xml file to the soap server, which can be an internal ip number that is not on the internet.

How to retrieve SOAP response header in a SOAPFaultException in Apache CXF

I have a trouble in Apache CXF where some code throws SOAPFaultException.
My original SOAP response is as following :
<?xml version="1.0" encoding="UTF-8"?><soap:Envelope ...>
<soap:Header>
<awsse:Session TransactionStatusCode="InSeries">
<awsse:SessionId>012GBF5W3H</awsse:SessionId>
<awsse:SequenceNumber>1</awsse:SequenceNumber>
<awsse:SecurityToken>3CGFFDO499VDB7WTRT37R6HPV</awsse:SecurityToken>
</awsse:Session>
</soap:Header>
<soap:Body>
<soap:Fault xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<faultcode>soap:Client</faultcode>
<faultstring>SOME_FAULT_STRING</faultstring>
<faultactor>SOME_FAULT_FACTOR</faultactor>
</soap:Fault>
</soap:Body>
</soap:Envelope>
I receive later a SOAPFaultException with information contains only soap:Body/soap:Fault. However, I need information from soap:Header section for further processing.
How can I pass these Header information to SOAPFaultException?

sudzc generates wrong soap request

I tried to use Sudzc to generate my SOAP requests. But the generated requests are wrong.
Below are the Sudzc generated soap request and the working SoapUI request of a very simple example request. Has anybody experienced the same problems?
Sudzc generated soap request:
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns="urn:sap-com:document:sap:soap:functions:mc-style">
<soap:Body>
<urn:ZcaptoSccMatDet>
<IvMatnr>D300</IvMatnr>
</urn:ZcaptoSccMatDet>
</soap:Body>
</soap:Envelope>
Working SoapUI generated message:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:sap com:document:sap:soap:functions:mc-style">
<soapenv:Header/>
<soapenv:Body>
<urn:ZcaptoSccMatDet>
<IvMatnr>D300</IvMatnr>
</urn:ZcaptoSccMatDet>
</soapenv:Body>
</soapenv:Envelope>
Kay,
If you need to change the output to soapenv take a look at the (Sudzc generated) code in Soap.m. In particular, check out the createEnvelope method. You can update the hardcoded references in this method from soap to soapenv.