I try to do following request to a WCF Web Service located here:
http://service.dreamlogistics.se/?wsdl
Full SOAP Request (SOAPUI):
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:dre="http://schemas.datacontract.org/2004/07/DreamLogisticsService" xmlns:tem="http://tempuri.org/">
<soapenv:Header/>
<soapenv:Body>
<tem:AddDelivery>
<tem:Credentials>
<dre:PartnerId>XX</dre:PartnerId>
<dre:Password>XX</dre:Password>
<dre:UserName>XX</dre:UserName>
</tem:Credentials>
<tem:Delivery>
<dre:CashOnDelivery>0</dre:CashOnDelivery>
<dre:CashOnDeliveryUnit></dre:CashOnDeliveryUnit>
<dre:Comment></dre:Comment>
<dre:ContactPerson></dre:ContactPerson>
<dre:DealId></dre:DealId>
<dre:DeliveryAddress>
<dre:Address1>Testgatan 10</dre:Address1>
<dre:Address2></dre:Address2>
<dre:City>Stockholm</dre:City>
<dre:CountryCode>SE</dre:CountryCode>
<dre:CustomerId>99</dre:CustomerId>
<dre:Name>Test Testsson</dre:Name>
<dre:Zip>11351</dre:Zip>
</dre:DeliveryAddress>
<dre:DeliveryNote>
<dre:File></dre:File>
<dre:Name></dre:Name>
</dre:DeliveryNote>
<dre:DeliveryRows>
<dre:DeliveryRow>
<dre:ArticleNumber>1</dre:ArticleNumber>
<dre:ProductName>Kalsong</dre:ProductName>
<dre:Quantity>0</dre:Quantity>
</dre:DeliveryRow>
<dre:DeliveryRow>
<dre:ArticleNumber>2</dre:ArticleNumber>
<dre:ProductName>Trosa</dre:ProductName>
<dre:Quantity>1</dre:Quantity>
</dre:DeliveryRow>
</dre:DeliveryRows>
<dre:DeliveryServiceType>PICKUP</dre:DeliveryServiceType>
<dre:Email></dre:Email>
<dre:EmailCopy></dre:EmailCopy>
<dre:ExternalId></dre:ExternalId>
<dre:FutureDeliveryDate></dre:FutureDeliveryDate>
<dre:GiftWrapping>1</dre:GiftWrapping>
<dre:InvoiceAddress>
<dre:Address1></dre:Address1>
<dre:Address2></dre:Address2>
<dre:City></dre:City>
<dre:CountryCode></dre:CountryCode>
<dre:Name></dre:Name>
<dre:Zip></dre:Zip>
</dre:InvoiceAddress>
<dre:Language></dre:Language>
<dre:OrderId>82712742424</dre:OrderId>
<dre:OrderMark></dre:OrderMark>
<dre:OrderType></dre:OrderType>
<dre:OrderValue></dre:OrderValue>
<dre:OriginalOrderId></dre:OriginalOrderId>
<dre:OurReference>Test</dre:OurReference>
<dre:PDF_DeliveryNoteURL></dre:PDF_DeliveryNoteURL>
<dre:PDF_InvoiceURL></dre:PDF_InvoiceURL>
<dre:PackingAlert></dre:PackingAlert>
<dre:PersonalMessage></dre:PersonalMessage>
<dre:PickListComment></dre:PickListComment>
<dre:RestOrder></dre:RestOrder>
<dre:ReturnOrder></dre:ReturnOrder>
<dre:SMS_Notification>913131</dre:SMS_Notification>
<dre:YourOrderId>81718191</dre:YourOrderId>
<dre:YourReference>Test Testsson</dre:YourReference>
</tem:Delivery>
</tem:AddDelivery>
</soapenv:Body>
</soapenv:Envelope>
But I get error:
The formatter threw an exception while trying to deserialize the message:
There was an error while trying to deserialize parameter
http://tempuri.org/:Delivery.
The InnerException message was 'There was an error deserializing the
object of type DreamLogisticsService.Delivery.
The value '' cannot be parsed as the type 'Int32'.'.
What is the problem? Is the values not converted to INT on the requesting server?
Please help!
Your Delivery element has a number of sub-elements which are of types which cannot be passed an empty string as a value. Either remove the elements from your XML (they have a minOccurs property value of 0) or set them to an accepted value. E.g. OrderType is of type Int, OrderValue is of type Decimal, and both RestOrder and ReturnOrder are of type Boolean.
See your XSD here for type information: http://service.dreamlogistics.se/service.svc?xsd=xsd2
Related
I have a HTTP request that return the following XML
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<NS1:obterAtividadesResponse xmlns:NS1="http://www.multiplan.com.br/APL/CLIE/SN/BPM/v1">
<atividades>
<atividade>
<instancia>
<idInstancia>2024</idInstancia>
</instancia>
<idAtividade>12887</idAtividade>
<nomeProcesso>Nota Fiscal ao Pagamento - Resumido</nomeProcesso>
<nomeAtividade>Aprovar Pagamento</nomeAtividade>
<statusAtividade>Received</statusAtividade>
<statusInstancia>Active</statusInstancia>
<dataLimite>2017-09-13T16:08:44.994+00:00</dataLimite>
<snapshot>76</snapshot>
<dadosNegocio>
<name>pedido</name>
<value>4500529987</value>
</dadosNegocio>
</atividade>
</atividades>
</NS1:obterAtividadesResponse>
</soapenv:Body>
</soapenv:Envelope>
I'm trying to extract the idAtividade content with XPath Extractor and save the result on atividadeId variable, but it's saving it's value on atividadeId_1 as you can see in the debug sampler result below:
atividadeId=
atividadeId_1=12887
atividadeId_matchNr=1
I'm using the following xpath query:
//atividades/atividade/idAtividade/text()
Is there a way to make it work as I need it?
Thanks
You should check Return entire XPath fragment instead of text content? checkbox.
It will them take the only text using your expression. See manual.
Also consider using Regular Expression Extractor.
If you have more than one atividade instance in response you can use the following XPath expression to get the first match:
//atividades/atividade[1]/idAtividade/text()
Or alternatively you can select idAtividade node value where nomeAtividade equals to Aprovar Pagamento with something like:
//atividades/atividade[nomeAtividade/text()='Aprovar Pagamento']/idAtividade
However given you have only one atividade instance your expression should work fine, you can test it using "XPath Tester" mode of the View Results Tree listener.
See XPath Tutorial and XPath Language Reference for comprehensive information on XPath syntax, axes, functions, etc.
My mistake, my test had an BeanShell Preprocessor setting the value of atividadeId variable to blank and I didn't know it was being executing after each sampler.
I am trying to extract NetSuite saved search results using webservices. In the response I am only seeing the normal fields(entered in the Results section) but not the Formula (Text) field.
Below is the image of the saved search results section.
Below is the request sent to NetSuite.
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="urn:platform_2014_2.webservices.netsuite.com" xmlns:platformMsgs="urn:messages_2014_2.platform.webservices.netsuite.com" xmlns:platformFaults="urn:faults_2014_2.platform.webservices.netsuite.com">
<soap:Header>
<urn5:preferences xmlns:urn5="urn:messages_2014_2.platform.webservices.netsuite.com">
<urn6:warningAsError xmlns:urn6="urn:messages_2014_2.platform.webservices.netsuite.com">false</urn6:warningAsError>
<urn7:disableMandatoryCustomFieldValidation xmlns:urn7="urn:messages_2014_2.platform.webservices.netsuite.com">false</urn7:disableMandatoryCustomFieldValidation>
<urn7:ignoreReadOnlyFields xmlns:urn7="urn:messages_2014_2.platform.webservices.netsuite.com">false</urn7:ignoreReadOnlyFields>
</urn5:preferences>
<urn8:searchPreferences xmlns:urn8="urn:messages_2014_2.platform.webservices.netsuite.com">
<urn9:bodyFieldsOnly xmlns:urn9="urn:messages_2014_2.platform.webservices.netsuite.com">true</urn9:bodyFieldsOnly>
<urn10:pageSize xmlns:urn10="urn:messages_2014_2.platform.webservices.netsuite.com">1000</urn10:pageSize>
<urn11:returnSearchColumns xmlns:urn11="urn:messages_2014_2.platform.webservices.netsuite.com">true</urn11:returnSearchColumns>
</urn8:searchPreferences>
</soap:Header>
<soap:Body>
<platformMsgs:search xmlns:platformMsgs="urn:messages_2014_2.platform.webservices.netsuite.com" xmlns="urn:messages_2014_2.platform.webservices.netsuite.com">
<platformMsgs:searchRecord xsi:type="ns1:CustomerSearchAdvanced" xmlns:ns1="urn:relationships_2014_2.lists.webservices.netsuite.com" savedSearchId="2469"/>
</platformMsgs:search>
</soap:Body>
The response I am seeing is below.
<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>
<platformMsgs:documentInfo
xmlns:platformMsgs="urn:messages_2014_2.platform.webservices.netsuite.com">
<platformMsgs:nsId>WEBSERVICES_TSTDRV840553_091920161097968934683523704_57aaf0b</platformMsgs:nsId>
</platformMsgs:documentInfo>
</soapenv:Header>
<soapenv:Body>
<searchResponse
xmlns="urn:messages_2014_2.platform.webservices.netsuite.com">
<platformCore:searchResult
xmlns:platformCore="urn:core_2014_2.platform.webservices.netsuite.com">
<platformCore:status isSuccess="true"/>
<platformCore:totalRecords>2</platformCore:totalRecords>
<platformCore:pageSize>1000</platformCore:pageSize>
<platformCore:totalPages>1</platformCore:totalPages>
<platformCore:pageIndex>1</platformCore:pageIndex>
<platformCore:searchId>WEBSERVICES_TSTDRV840553_091920161097968934683523704_57aaf0b</platformCore:searchId>
<platformCore:searchRowList>
<platformCore:searchRow xsi:type="listRel:CustomerSearchRow"
xmlns:listRel="urn:relationships_2014_2.lists.webservices.netsuite.com">
<listRel:basic
xmlns:platformCommon="urn:common_2014_2.platform.webservices.netsuite.com">
<platformCommon:comments>
<platformCore:searchValue>test</platformCore:searchValue>
</platformCommon:comments>
<platformCommon:entityId>
<platformCore:searchValue>test c 97161</platformCore:searchValue>
</platformCommon:entityId>
<platformCommon:entityStatus>
<platformCore:searchValue internalId="13"/>
</platformCommon:entityStatus>
<platformCommon:internalId>
<platformCore:searchValue internalId="59951"/>
</platformCommon:internalId>
</listRel:basic>
</platformCore:searchRow>
<platformCore:searchRow xsi:type="listRel:CustomerSearchRow"
xmlns:listRel="urn:relationships_2014_2.lists.webservices.netsuite.com">
<listRel:basic
xmlns:platformCommon="urn:common_2014_2.platform.webservices.netsuite.com">
<platformCommon:comments>
<platformCore:searchValue>test</platformCore:searchValue>
</platformCommon:comments>
<platformCommon:entityId>
<platformCore:searchValue>test c 97162</platformCore:searchValue>
</platformCommon:entityId>
<platformCommon:entityStatus>
<platformCore:searchValue internalId="13"/>
</platformCommon:entityStatus>
<platformCommon:internalId>
<platformCore:searchValue internalId="59952"/>
</platformCommon:internalId>
</listRel:basic>
</platformCore:searchRow>
</platformCore:searchRowList>
</platformCore:searchResult>
</searchResponse>
</soapenv:Body>
I don't see any explanation/examples related to this in NetSuite help guide as well.
Is there any other way that we need to trigger the request for extracting formula fields? Any pointers would be greatly helpful.
Thanks
I've been looking into this same topic and I don't believe Web Services supports formula fields in the result set. There appears to be no mechanism for returning them in a statically defined SOAP response. In my case, I needed the following formula.
GREATEST({trandate},{lastmodifieddate},{linelastmodifieddate},{billingtransaction.trandate},{billingtransaction.lastmodifieddate},{billingtransaction.linelastmodifieddate})
It existed in my saved search and did not throw an error when referenced from SuiteTalk. However, the formula field was not present as a column in my result set. I had to include each individual field used in my formula in the saved search and then recreate the formula in code.
If you need to use a formula as part of your filter criteria (to apply to a saved search), it will need to be defined in the saved search itself. You will not be able to apply formula based filters via the SuiteTalk API.
TransactionSearchAdvanced customSearch = new TransactionSearchAdvanced()
{
savedSearchScriptId = "customsearch_[Your ID here]"
,
criteria = new TransactionSearch()
{
[Formula fields are NOT supported here]
}
};
I am developing a SOAP client in Matlab for connection a Web Service. What I am doing is the following script:
createClassFromWsdl('http://192.168.107.239/WSDL/v4.0/iLON100.wsdl')
obj = iLON100
methods(obj)
With the next result:
Methods for class iLON100:
Clear Get List Set display
Delete InvokeCmd Read Write iLON100
Then, I am editing for example the method List in order to request the list of Items for the service. The dot m file is:
% Build up the argument lists.
values = { '','//Item[#xsi:type="Dp_Cfg"]'};
names = { 'iLonItem','xSelect'};
types = {};
% Create the message, make the call, and convert the response into a variable.
soapMessage = createSoapMessage('http://wsdl.echelon.com/web_services_ns/ilon100/v4.0/message/',
'List', values, names, types, 'document');
I have also a SOAP tester from the vendor of the device. Then, if I compare both XML requests, they differ as you can see in the next example (firstly the original request and secondly the Matlab one):
<SOAP-ENV:Body>
<List xmlns="http://wsdl.echelon.com/web_services_ns/ilon100/v4.0/message/">
<iLonItem>
<xSelect>
//Item[#xsi:type="Dp_Cfg"]
</xSelect>
</iLonItem>
</List>
</SOAP-ENV:Body>
<soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<List xmlns="http://wsdl.echelon.com/web_services_ns/ilon100/v4.0/message/">
<iLonItem/>
<xSelect>Item</xSelect>
</List>
</soap:Body>
As you can observe, the tags are not included as sub-tags. I would like to know how to do it and generate the same structure of XML for sending the SOAP request correctly.
Thank you so much,
At the end, I have solved it by creating a structure as follows:
myStruct = struct('iLonItem',struct('xSelect','//Item[#xsi:type="Dp_Cfg"]'))
This structure is inserted into "values" and the method's name "iLONItem".
I would appreciate any help with following:
XML Response:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<ns3:GetSeatPlanAvailabilityResponse xmlns:ns2="http://stagecoach.com/schemas/engine/common" xmlns:ns3="http://stagecoach.com/schemas/engine/seat">
<ns3:header>
<ns2:version>1.0</ns2:version>
</ns3:header>
<ns3:journeyDetails>
<ns2:journeyId>4769046</ns2:journeyId>
<ns2:origin>
<ns2:cityId>120</ns2:cityId>
<ns2:description>Memphis, TN</ns2:description>
<ns2:stop>MEM</ns2:stop>
</ns2:origin>
<ns2:destination>
<ns2:cityId>320</ns2:cityId>
<ns2:description>Austin, TX</ns2:description>
<ns2:stop>AUS</ns2:stop>
</ns2:destination>
<ns2:departureDate>2014-07-28Z</ns2:departureDate>
<ns2:departureTime>04:00:00Z</ns2:departureTime>
</ns3:journeyDetails>
<ns3:noOfNonReservableSeatsRemaining>70</ns3:noOfNonReservableSeatsRemaining>
<ns3:singleSeats>
<ns2:singleSeat>
<ns2:seatPlanKey>US1</ns2:seatPlanKey>
<ns2:seatId>7ecc7775-6caa-4e17-80d7-6cfa46be507b</ns2:seatId>
<ns2:seatNumber>1</ns2:seatNumber>
<ns2:seatClassCode>FRN</ns2:seatClassCode>
<ns2:seatDeck>UPPER</ns2:seatDeck>
<ns2:availableForSelection>true</ns2:availableForSelection>
</ns2:singleSeat>
<ns2:singleSeat>
<ns2:seatPlanKey>US2</ns2:seatPlanKey>
<ns2:seatId>fe73cc9a-7c4f-4d1f-80e5-6131926af694</ns2:seatId>
<ns2:seatNumber>2</ns2:seatNumber>
<ns2:seatClassCode>FRN</ns2:seatClassCode>
<ns2:seatDeck>UPPER</ns2:seatDeck>
<ns2:availableForSelection>true</ns2:availableForSelection>
</ns2:singleSeat>
<ns2:singleSeat>
<ns2:seatPlanKey>US3</ns2:seatPlanKey>
<ns2:seatId>20121517-d657-438f-bc26-92bb98b20bb5</ns2:seatId>
<ns2:seatNumber>3</ns2:seatNumber>
<ns2:seatClassCode>FRN</ns2:seatClassCode>
<ns2:seatDeck>UPPER</ns2:seatDeck>
<ns2:availableForSelection>true</ns2:availableForSelection>
</ns2:singleSeat>
<ns2:singleSeat>
<ns2:seatPlanKey>US4</ns2:seatPlanKey>
<ns2:seatId>b93be6b7-ebb9-482e-9ec2-3c9d32beab32</ns2:seatId>
<ns2:seatNumber>4</ns2:seatNumber>
<ns2:seatClassCode>FRN</ns2:seatClassCode>
<ns2:seatDeck>UPPER</ns2:seatDeck>
<ns2:availableForSelection>true</ns2:availableForSelection>
</ns2:singleSeat>
</ns3:singleSeats>
<ns3:doubleSeats/>
<ns3:salesClassInformation>
<ns2:seatClassCode>FRN</ns2:seatClassCode>
<ns2:salesClassCode>SFRN</ns2:salesClassCode>
<ns2:salesClassDescription/>
<ns2:price>3.00</ns2:price>
<ns2:maxPassengers>1</ns2:maxPassengers>
</ns3:salesClassInformation>
<ns3:salesClassInformation>
<ns2:seatClassCode>LEG</ns2:seatClassCode>
<ns2:salesClassCode>SLEG</ns2:salesClassCode>
<ns2:salesClassDescription/>
<ns2:price>7.00</ns2:price>
<ns2:maxPassengers>1</ns2:maxPassengers>
</ns3:salesClassInformation>
<ns3:salesClassInformation>
<ns2:seatClassCode>TBL</ns2:seatClassCode>
<ns2:salesClassCode>STBL</ns2:salesClassCode>
<ns2:salesClassDescription/>
<ns2:price>9.00</ns2:price>
<ns2:maxPassengers>1</ns2:maxPassengers>
</ns3:salesClassInformation>
</ns3:GetSeatPlanAvailabilityResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
XML Request:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:bas="http://stagecoach.com/schemas/engine/basket" xmlns:com="http://stagecoach.com/schemas/engine/common">
<soapenv:Header/>
<soapenv:Body>
<bas:AddSeatToBasketRequest>
<bas:header>
<com:version>1.0</com:version>
<com:retailOperation>US</com:retailOperation>
<com:channel>WEB</com:channel>
</bas:header>
<bas:basketItemId>56227</bas:basketItemId>
<!--1 or more repetitions:-->
<bas:seatSelectionInput>
<com:passengerOrdinal>1</com:passengerOrdinal>
<com:SeatId>7ecc7775-6caa-4e17-80d7-6cfa46be507b</com:SeatId>
</bas:seatSelectionInput>
<bas:seatSelectionInput>
<com:passengerOrdinal>2</com:passengerOrdinal>
<com:SeatId>d653b812-3230-4a31-88e7-a4ad867fb131</com:SeatId>
</bas:seatSelectionInput>
</bas:AddSeatToBasketRequest>
</soapenv:Body>
</soapenv:Envelope>
My requirement is such that I need to pass <ns2:seatId> to another request, first it should look for condition when <ns2:availableForSelection> is TRUE, or else it should skip to 'FALSE' and select `and pass it to request
Could some one please provide groovy script for above logic?
You will need to adjust the below code for your exact needs, as there is still information missing in your question.
// to read a node from your Response
def grUtils = new com.eviware.soapui.support.GroovyUtils(context)
// depending on when / how your are doing this, you will need to provide the exact test step name
def xmlHolder = grUtils.getXmlHolder("${context.currentStep.name}#Response")
def seatIdNode = xmlHolder.getDomNode("//*:singleSeat[availableForSelection='true']/seatId")
// if nothing was found
if(seatIdNode == null) {
testRunner.cancel("seatId was not found!")
return
}
// you can store this in a testcase property
testRunner.testCase.setPropertyValue("seatId", seatId.firstChild.nodeValue)
// and use it in your next Request as '${#TestCase#seatId}'
There is a way to write the seatId directly into the next Request. If you wish to go that route, I have a blog entry that describes how to generate XML requests.
Lastly, all of this could also be done with pure SoapUI test steps, without the use of Groovy. A Conditional GoTo step would check if the XPath above exists, and bypass your next Request if it is not. A Transfer Property step using the same XPath as above would transfer the value of seatId to your next Request.
I have written webservices in java.
public List<ReflexFundInfo> method(List<Integer> Ids ) {
List<Object> list = new ArrayList<Object>();
//added few elements on that array
return list;
}
Just want to check is this the right way to pass the LIST into the method?If I'll check the SOAP message i am getting like:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:dmo="http://com.test.org" xmlns:dfow="http://localhost:7011/LMX_WEB/services/WebServiceTest">
<soapenv:Header/>
<soapenv:Body>
<dmo:method>
<dmo:Ids>
</dmo:Ids>
</dmo:method>
</soapenv:Body>
</soapenv:Envelope>
Basically I am testing the webservices using SOAPUI Tool .
your method takes List of integers as an input and returns back the List of ReflexFundInfo, If this is your intention , then you are doing right.