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.
Related
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.
An API I am communicating with is Soap based and requires XML with inner XML (CDATA) in the request.
For the service connector action test I have hard-coded the inner xml with this format:
<![CDATA[
<Application xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ApplicationCrossReferenceId="123">
...
...
</Application> ]]>
where the dots indicate the data contained.
When running the test the request payload has been transformed to the html entity for < which is $lt; - as seen below :
Is there a way to avoid this?
This is a bug in Informatica. the other characters are decoded back to their original correctly, as described in KB 512858, > and < however are not decoded.
A bug report has been raised 29.05.2020.
Edit: Further investigation revealed that using CDATA was not necessary in my case, instead I was able to use the following input for the body binding:
<Application xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ApplicationCrossReferenceId="123">
...
...
</Application>
Here's my requirement:
I have a text ="Thank you for your response". I want to initiate a call with a user, and when the user picks up the call, i want the text message to be turned into a voice message.
Here's what i have so far:
I am initiating a twilio call:
twilioClient.calls.create(to=user_number, from_=twilio_number, \
url="https://testserver.com/call/")
In urls.py, i have /call/ that points to my django view module
In view, the module looks like:
def testTwilioCall(request):
return HttpResponse(open('/path/call.xml').read(), content_type='application/xml')
-call.xml looks like:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say voice="woman">Thank you for your response.</Say>
<Record maxLength="20" />
</Response>
Here's whats happening:
User gets a call, and the call says - "Sorry application error".
I am not sure what is going wrong. When i replace the url parameter with https://demo.twilio.com/welcome/voice/, it works.
I also double checked that the xml is being displayed fine from the browser.
Not sure where i am going wrong with rendering the xml.
PS: testserver is just a placeholder.
Our SOAP web service provider insist on removing empty field tags from the request because it breaks the service. Is that right practice?
See below example of request. StockID is empty tag. Should it break the SOAP service?
I would like to know best practice around empty tags in request
<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
<soap:Body xmlns:m="http://www.example.org/stock">
<m:GetStockPrice>
<m:StockName>IBM</m:StockName>
<m:StockID/>
</m:GetStockPrice>
</soap:Body>
</soap:Envelope>
This Depends on how the rest of the system is programmed. There are 3 ways of sending StockID:
Empty tag
Tag removed
Tag With nil="true"
What is probably happening for the first item above is that the program is deserializing the tag as an empty string, and then crashing since there is no Stock id = "".
In the 2 last items above it would deserialize as NULL and then not try and find a Stock id = NULL.
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>