Importing the wsdl file in postman - web-services

I am trying to access the client URL web service in postman. I used the import link to import the wsdl file client URL in postman and successfully generated the collection. However, upon testing the request, I am unable to retrieve the data from the client server. I am only getting an empty element in the response body. I followed some of the SOAP Web Service tutorial on youtube and it is still the same. The client provided me the valid username for me to test but still the same.
This is my request body:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<zhi_sa_mgt xmlns="urn:mss:jfnllns:df">
<P_DATE>2022-10-22</P_DATE>
<P_NAME>
<item>HPOITY</item>
</P_NAME>
</zhi_sa_mgt>
</soap:Body>
</soap:Envelope>
And the response body:
<?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>
<zhi_sa_mgt xmlns="urn:mss:jfnllns:df">
<P_DATA/>
</zhi_sa_mgt>
</soap:Body>
</soap:Envelope>
I just wanted to ask, what could be the possible reason/s on why I am getting the empty tag <P_DATA>? This is my first SOAP web service task and I cannot figure out why I cant retrieve the data from the client server. Thank you in advance for your response.

Related

How do I remove operation element from soap envelope body in WCF?

I have a WCF service setup mostly to a customer's spec, yet there is one extra element required of an envelope body that I'm trying to exclude based on the customer's sample request.
These are my service and operation contracts:
[ServiceContract(Namespace="http://www.somenamespace.com")]
public interface IProcessPayment
{
[OperationContract]
ResponseSubmitPayment execute(RequestSubmitPayment RequestSubmitPayment);
}
This is what they are sending to test my service with:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:pay="http://www.somenamespace.com">
<soapenv:Header/>
<soapenv:Body>
<pay:RequestSubmitPayment>
<!-- irrelevant stuff -->
</pay:RequestSubmitPayment>
</soapenv:Body>
</soapenv:Envelope>
and this is what my service expects (based on SOAPUI):
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:pay="http://www.somenamespace.com">
<soapenv:Header/>
<soapenv:Body>
<pay:execute> <!-- I want to remove this! -->
<pay:RequestSubmitPayment>
<!-- irrelevant stuff -->
</pay:RequestSubmitPayment>
</pay:execute> <!-- I want to remove this! -->
</soapenv:Body>
</soapenv:Envelope>
How can I configure my WCF service to not require or exclude that element? The client has told me they have many other customers with it successfully tested and implemented. SOAP 1.1 is my understanding of what they're sending.
Thanks in advance!
Not sure it is doable in operationcontract. Try using a message contract, it will give you the flexibility you need. If that fails use an xmlserializer contract with method flag ParameterStyle = SoapParameterStyle.Bare.

avoiding prefixes with java-ws and apache cfx

I'm using jax-ws with apache cxf every things seems ok , except the prefix in soap envelope
It looks like this now
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns2:CreateCustomer xmlns:ns2="http://tempuri.org">
<ns2:myVar>
</ns2:myVar>
<ns2:CreateCustomer xmlns:ns2="http://tempuri.org">
I'm trying to avoid the prefixes but keep the xmlns to look like this ...
<CreateCustomer xmlns="http://tempuri.org/">
<myVar>

Sending a SOAP Call

I'm learning how to send and receive a SOAP call. I have the required parameters available with me like username , password and the URL of the WSDL/WebService.I lso know a sample SOAP reply that I'm expecting which is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:infoLookupResponse xmlns:ns1="urn:vtsPhoneNumberLookup">
<phoneNumber xsi:type="xsd:string">4444444444</phoneNumber>
<Type xsi:type="xsd:string">Landline</Type>
<OCN xsi:type="xsd:string">2222</OCN>
<OVERALLOCN xsi:type="xsd:string">2103</OVERALLOCN>
<COMPANY xsi:type="xsd:string">ABC Inc</COMPANY>
<DBA xsi:type="xsd:string">ABC Inc</DBA>
<CommonName xsi:type="xsd:string">ABC</CommonName>
<HOLDINGCOMPANY xsi:type="xsd:string">ABC Communications Inc</HOLDINGCOMPANY>
<MANAGEMENT xsi:type="xsd:string"></MANAGEMENT>
<SMS xsi:type="xsd:string"></SMS>
</ns1:infoLookupResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
I have gone through online stuff and based on my understanding, in order to send the SOAP request, I need to have a raw XML of the same format that I'm
expecting ( as mentioned above). The condition in my case is that a user will be submitting a phone number using an HTML Page and that will be sent as a SOAP
request expecting the aforementioned reply from the server.
In the above case, a user would have submitted 4444444444 as a phone number. So,I understand that I need to create raw XML type of phoneNumber and my questions is, do I need to create raw XML for Type,OCN,OVERALLOCN,COMPANY,DBA,CommonName,HOLDINGCOMPANY,MANAGEMENT and SMS as well?
Please let me know if there is anything wrong with what I have understood so far. Also, let me know if you would like me to paste some specific part of WSDL which will help you in answering/understanding my question.

How to call a webservice method for testing, e.g. from a browser

There is a dll webservice (made with Delphi) that has a method called List which returns a list of strings (widestring).
Is there any method for calling that service without having to write a client application for consuming it?.
Ex.: http://misitio.com:8080/miwebservice.dll?methodname=list
The Chrome App Postman can send SOAP requests. You just need to provide the Web Service URL, select POST, set the proper content-type header (text/xml, application/soap+xml, etc.), and provide the proper xml soap body in the request. Click Send.
Below is an example request which posts to a free weather web service.
Your request could be something like:
POST /WeatherWS/Weather.asmx/GetCityWeatherByZIP HTTP/1.1
Host: wsf.cdyne.com
Cache-Control: no-cache
Postman-Token: e5bc46a4-71ac-f357-78a7-c4b4de894afb
Content-Type: application/x-www-form-urlencoded
ZIP=90210
And the response will be:
<?xml version="1.0" encoding="utf-8"?>
<WeatherReturn xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://ws.cdyne.com/WeatherWS/">
<Success>true</Success>
<ResponseText>City Found</ResponseText>
<State>CA</State>
<City>Beverly Hills</City>
<WeatherStationCity>Van Nuys</WeatherStationCity>
<WeatherID>4</WeatherID>
<Description>Sunny</Description>
<Temperature>68</Temperature>
<RelativeHumidity>54</RelativeHumidity>
<Wind>CALM</Wind>
<Pressure>29.89R</Pressure>
<Visibility />
<WindChill />
<Remarks />
</WeatherReturn>

How to change the way coldfusion send the soap response?

I have a coldfusion webservice which takes in XML data and send back the acknowledgement.
When there is an error the current code returns me the soap response as
<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:Body>
<ns1:updatePendingTicketsResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://v02.intouchdataservice">
<updatePendingTicketsReturn xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"><![CDATA[<fault>
<faultcode>TO BE DEFINED IF NEEDED</faultcode>
<faultstring >Content is not allowed in prolog.</faultstring>
<faultactor>InTouch</faultactor>
</fault>]]></updatePendingTicketsReturn>
</ns1:updatePendingTicketsResponse>
</soapenv:Body>
</soapenv:Envelope>
But what I would like to have in response is
<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:Body>
<soapenv:Fault>
<faultcode>TO BE DEFINED IF NEEDED</faultcode>
<faultstring >Content is not allowed in prolog.</faultstring>
<faultactor>InTouch</faultactor>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
Is there a way we can change the way coldfusion sends back the response when there is an exception?
In addition to that, Is there a way we can add an XML schema to the coldfusion WSDL to validate the XML document thats been send ?
Thank you
I think no but you can put whole code in try and catch define your own response code.
You can use the wsdlfile attribute of <cfcomponent /> to specify a custom WSDL.
http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7e0e.html
http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec22c24-78a6.html