How can I input array using SOAPUI? - soap

Below is the WSDL format for customerNames.
<xsd:element name="CustomersNames" minOccurs="0" maxOccurs="unbounded" type="xsd:string"/>
Please Advice that how can i pass input to test soap request using SOAPUI.
<CustomersNames>--inpuhere--</CustomersNames>

Try to pass Customer name like below.
<CustomersNames>Andrew</CustomersNames>
<CustomersNames>Mohan</CustomersNames>

Try this
<!--Zero or more repetitions:-->
<arg0>5401</arg0>
<arg0>5401</arg0>
<!--Zero or more repetitions:-->
<arg1>0904</arg1>
<arg1>0904</arg1>
<!--Zero or more repetitions:-->
<arg2>20150101</arg2>
<arg2>20150101</arg2>
<!--Zero or more repetitions:-->
<arg3>20170101</arg3>
<arg3>20170101</arg3>
I am getting data like this:
public ArrayList<String> method (List<String> A,
List<String> B,
List<String> C,
List<String> D) {
It works for me!

Related

Use column value in M Query / Power Query

I've a short code to make a SOAP request to fetch data into Power BI. The problem is that I need to give a Session_id for the requests:
let
SourceURL = "HTTPS://SOAP.E-BOEKHOUDEN.NL/SOAP.ASMX?WSDL", //host provides this address. Url ends often with "wsdl"
options = [ #"Authorization" ="Basic USER:PASS=", //User:pass decoded with SOAP UI
#"Accept-Encoding"= "gzip,deflate",
// SOAPAction="",
#"Content-Type"="text/xml;charset=UTF-8",
#"Connection"="Keep-Alive"
],
WebContent = Web.Contents(SourceURL,
// Content options in Web.Contents() requires you to authenticate anonymously !
[Content=Text.ToBinary("
<soap:Envelope xmlns:soap=""http://www.w3.org/2003/05/soap-envelope"" xmlns:soap1=""http://www.e-boekhouden.nl/soap"">
<soap:Header/>
<soap:Body>
<soap1:OpenSession>
<!--Optional:-->
<soap1:Username>***</soap1:Username>
<!--Optional:-->
<soap1:SecurityCode1>***</soap1:SecurityCode1>
<!--Optional:-->
<soap1:SecurityCode2>***</soap1:SecurityCode2>
<!--Optional:-->
<soap1:Source></soap1:Source>
</soap1:OpenSession>
</soap:Body>
</soap:Envelope>
"),
Headers=options]) ,
XmlContent = Xml.Tables(WebContent)
in
XmlContent
Now this code is to get the Session_id. To get the other data I need to give the session_id instead of SecurityCode2 in a similar request:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://www.e-boekhouden.nl/soap">
<soapenv:Header/>
<soapenv:Body>
<soap:GetMutaties>
<!--Optional:-->
<soap:SessionID>***</soap:SessionID>
<!--Optional:-->
<soap:SecurityCode1>***</soap:SecurityCode1>
<!--Optional:-->
<soap:cFilter>
</soap:cFilter>
</soap:GetMutaties>
</soapenv:Body>
</soapenv:Envelope>
Can I use a column value as parameter/variable that I can use in the body?
You don't even need a column for that. Create a query that just returns a string:
and then you can reference that query anywhere else:

sabre car new bookAPI EnhancedVehBookRQ

I tried to call EnhancedVehBookRQ API with CERT ENV
This is my request and response
REQUEST:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sec="http://schemas.xmlsoap.org/ws/2002/12/secext" >
<soapenv:Header>
<Security xmlns="http://schemas.xmlsoap.org/ws/2002/12/secext">
<BinarySecurityToken>
token
</BinarySecurityToken>
</Security>
<MessageHeader xmlns="http://www.ebxml.org/namespaces/messageHeader">
<From>
<PartyId type="urn:x12.org:IO5:01">from</PartyId>
</From>
<To>
<PartyId type="urn:x12.org:IO5:01">to</PartyId>
</To>
<CPAId>hiddendata
</CPAId>
<ConversationId>hiddendata</ConversationId>
<Action>EnhancedVehBookRQ</Action>
<MessageData>
<MessageId>1001</MessageId>
<Timestamp>2021-08-18T10:00:01</Timestamp>
<!--Optional:-->
<TimeToLive>2021-08-19T10:00:01</TimeToLive>
<!--Optional:-->
<Timeout>0</Timeout>
</MessageData>
</MessageHeader>
</soapenv:Header>
<soapenv:Body>
<EnhancedVehBookRQ xmlns="http://services.sabre.com/sp/enhanced/veh/book/v1" version="1.0.0">
<VehBook>
<BookingInfo >
<BookingKey>23accd05-4770-4d1c-a286-ab0e6f360fc5
</BookingKey>
</BookingInfo>
<Customer NameNumber="1.1">
<Address>
<CityName>DALLAS</CityName>
<CountryCode>US</CountryCode>
<PostalCode>12345</PostalCode>
<StateCountyProv StateCode="TX" />
<StreetNmbr>1234 TEST ADDRESS</StreetNmbr>
</Address>
</Customer>
<RentalPaymentPrefs>
<GuaranteePrepaid Type="GUARANTEE">
<PaymentCard>
<CardCode>DC</CardCode>
<CardNumber>311234567685619</CardNumber>
<ExpiryMonth>12</ExpiryMonth>
<ExpiryYear>2022</ExpiryYear>
<FullCardHolderName>
<LastName>Monster</LastName>
</FullCardHolderName>
</PaymentCard>
</GuaranteePrepaid>
</RentalPaymentPrefs>
<VehRentalCore Quantity="1" />
</VehBook>
</EnhancedVehBookRQ>
</soapenv:Body>
</soapenv:Envelope>
I could not move ahead with car booking, getting errors like this
<Message code="ERR.SP.INTERNAL_ERROR">TravelItineraryReadRQ: After maximum retry count it was not possible to successfully execute target service</Message>
Can anybody please confirm whether SOAP requst is proper or not or I am missing something from my side
Yes, before running EnhancedVehBookRQ API you need to run PassengerDetailsRQ with TravelIntinerary details in it. On the success of this API use the response details for the request of this API and then run it

JBOSS fuse Optional tag on Interface method argument

I have two arguments to interface method
I have the following code
package com.pk.testAtrifact.incident;
public interface ServiceCountry {
/**
* Operation to country
*/
OutCountry getCountry(Header header,InputCountry input);
}
when it comes in WSDL it comes like this
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
<soapenv:Header/>
<soapenv:Body>
<mpos:getCountry>
<!--Optional:-->
<v1:RequestHeader>
<!--Optional:-->
There is Optional tag on RequestHeader. I dont want to keep header optional. How can i do this

Invalid Soap Call

Why doesn't this soap call work for this URL ?
http://services.aonaware.com/DictService/DictService.asmx?op=Define
<v:Envelope xmlns:i="http://www.w3.org/1999/XMLSchema-instance" xmlns:d="http://www.w3.org/1999/XMLSchema" xmlns:c="http://schemas.xmlsoap.org/soap/encoding/" xmlns:v="http://schemas.xmlsoap.org/soap/envelope/">
<v:Header />
<v:Body>
<Define xmlns="http://tempuri.org/" id="o0" c:root="1">
<word i:type="d:string">Name</word>
</Define>
</v:Body>
</v:Envelope>
But this one does
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://services.aonaware.com/webservices/">
<soapenv:Header/>
<soapenv:Body>
<web:Define>
<!--Optional:-->
<web:word>Test</web:word>
</web:Define>
</soapenv:Body>
</soapenv:Envelope>
Because they are different: not only in content but also in namespace definition, to correct the first one you've to atleast use the correct namespace so use http://services.aonaware.com/webservices/ for your <Define> element as you do in the second one:
<v:Envelope xmlns:i="http://www.w3.org/1999/XMLSchema-instance" xmlns:d="http://www.w3.org/1999/XMLSchema" xmlns:c="http://schemas.xmlsoap.org/soap/encoding/" xmlns:v="http://schemas.xmlsoap.org/soap/envelope/">
<v:Header />
<v:Body>
<Define xmlns="http://services.aonaware.com/webservices/" id="o0" c:root="1">
<word i:type="d:string">Name</word>
</Define>
</v:Body>
</v:Envelope>
Then make sure also that id an c:root are valid attributes in your xsd for <Definition> and i:type it's a correct one for <word>.
EDIT
I invoke http://services.aonaware.com/DictService/DictService.asmx with SOAPUI using my corrected request and it response correctly:
<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>
<DefineResponse xmlns="http://services.aonaware.com/webservices/">
<DefineResult>
<Word>Name</Word>
<Definitions>
<Definition>
<Word>Name</Word>
<Dictionary>
<Id>gcide</Id>
<Name>The Collaborative International Dictionary of English v.0.44</Name>
</Dictionary>
<WordDefinition>Name \Name\ (n[=a]m), n. [AS. nama; akin to D. naam, OS. & OHG.
...
[1913 Webster]</WordDefinition>
</Definition>
<Definition>
<Word>Name</Word>
<Dictionary>
<Id>gcide</Id>
<Name>The Collaborative International Dictionary of English v.0.44</Name>
</Dictionary>
<WordDefinition>Name \Name\ (n[=a]m), v. t. [imp. & p. p. {Named} (n[=a]md); p.
...
</WordDefinition>
</Definition>
</Definitions>
</DefineResult>
</DefineResponse>
</soap:Body>
</soap:Envelope>
Hope this helps,

JAXB Binding for SOAP request parameter in JAXWS

My task is to write a webservice for an update operation where a list of objects are passed to the method.
#WebMethod(operationName = "updateObjects", action = "urn:preferences")
public boolean updateObjects(List<MyObject> objects){
}
The class MyObject is simple enough.
#XmlRootElement(name="Object")
public class MyObject{
private String item1;
private String item2;
}
Now the problem statement. When I look at the SOAP request for this method (that SOAP UI generated for me), the request looks like below :
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:pref="preferences">
<soapenv:Header/>
<soapenv:Body>
<pref:updateObjects>
<!--Zero or more repetitions:-->
<arg0>
<!--Optional:-->
<item1>?</item1>
<!--Optional:-->
<item2>?</item2>
</arg0>
</pref:updateObjects>
</soapenv:Body>
</soapenv:Envelope>
but I want it to look like below.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:pref="preferences">
<soapenv:Header/>
<soapenv:Body>
<pref:updateObjects>
<!--Zero or more repetitions:-->
<Objects>
<Object>
<!--Optional:-->
<item1>?</item1>
<!--Optional:-->
<item2>?</item2>
</Object>
<Object>
<!--Optional:-->
<item1>?</item1>
<!--Optional:-->
<item2>?</item2>
</Object>
</Objects>
</pref:updateObjects>
</soapenv:Body>
</soapenv:Envelope>
Can somebody please advice. Thanks in advance.
You only need to add a 'wrapper' to your List of objects like this:
#XmlRootElement(name="objects")
public class MyObjects{
#XmlElement(name="object")
List<MyObject> myObjects;
}
public class MyObject{
private String item1;
private String item2;
}
NOTE: changing root element from arg0 to objects with the tag #XmlRootElement(name="objects") will not work because your <objects> is not a root element in the web service definition. Actually it is part of your <wsdl:message> (so JAXB will discart it).
What you need to change is the web service message adding a #WebParam(name = "objects") to your #WebMethod like:
#WebMethod(operationName = "updateObjects", action = "urn:preferences")
public boolean updateObjects(#WebParam(name = "objects") MyObjects objects){
}
If you do not want use a 'wrapper', you can keep your WebMethod but like this:
#WebMethod(operationName = "updateObjects", action = "urn:preferences")
public boolean updateObjects(#WebParam(name = "object") List<MyObject> objects){
}
but you will loose the <objects> wrapper. The request should be something like this:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:pref="preferences">
<soapenv:Header/>
<soapenv:Body>
<pref:updateObjects>
<!--Zero or more repetitions:-->
<object>
<!--Optional:-->
<item1>?</item1>
<!--Optional:-->
<item2>?</item2>
</object>
</pref:updateObjects>
</soapenv:Body>
</soapenv:Envelope>