Why there are different request definition for one wsdl - soap

I have been provided a WSDL by client at the beginning of the project, I ended up creating a request and response objects for given WSDL using SOAP UI, where the request object would look as follows,
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:def="http://DefaultNamespace">
<soapenv:Header/>
<soapenv:Body>
<def:someOperation soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<in0 xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">SOME_DATA</in0>
</def:someOperation>
</soapenv:Body>
</soapenv:Envelope>
But when the actual request coming from the production environment for the same wsdl is,
<?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>
<someOperation xmlns="urn:SOMEService">
<in0>SOME_DATA</in0>
</someOperation>
</soap:Body>
</soap:Envelope>
If you observed the name spaces are the same but it does has difference for names like in 1st request its <soapenv:Envelope and same in the 2nd request is <soap:Envelope in each node of xml, the definition of operation is also different in both the request in 1st it is,
<def:someOperation soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<in0 xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">SOME_DATA</in0>
</def:someOperation>
and in 2nd it is,
<someOperation xmlns="urn:SOMEService">
<in0>SOME_DATA</in0>
</someOperation>
I do not know why the interpretation is different, and is it safe to have to change from 1st to 2nd.
IN both the cases actual operation is working fine I do not have any issues with that, it is just cant able to figure out reason of difference.
Could somebody please assist me with this or any direction to a document which could clarify my doubt would be great.

it does has difference for names like in 1st request its <soapenv:Envelope and same in the 2nd request is <soap:Envelope in each node of xml
Here soapenv and soap are local prefix names of namespace=http://schemas.xmlsoap.org/soap/envelope/. Hence, logically both are same and has no difference.
the definition of operation is also different in both the request in 1st v/s 2nd
In case of 1st, def:someOperation XML nodes belongs to namespace = xmlns:def="http://DefaultNamespace"
And in 2nd case, name space "urn:SOMEService" is directly defined with XML Nodes So
if DefaultNamespace is exactly same as SOMEService, the it means both of the XML Operation XMLs are same.
Hence,
soapenv v/s soap are same in your case.
Operations, you could conclude based on actual value of SOMEService v/s DefaultNamespace.
Hope it helps.

Related

SOAP request uneffective on smartserver2.2

I am new here. I work as a developper on a very small company. I am in charge of developping a software (asp.net/c#) in order to monitor street lightings via smartservers (old version : 2.2).
I use SOAP messages to change the configuration and the values of each individual lamp (via datapoint).
I mostly succeeded to create schedulers and also to add datapoints.
But I am facing an issue when I want to add presets to a datapoint.
For example, these are 3 presets that could be used by the scheduler to control the lamp power (nviLampValue):
ON with a power lamp value of 100% represented by the formatted value '100.0 1'
OFF with a power lamp value of 0% represented by the formatted value '0.0 0'
PRESET1 at 80% with the formatted value '80.0 1'
I created a SOAP request (SET) to configure the presets for a datapoint (i.e. Net/LON/P68/OLC[0]/nviLampValue_1) but after a lot of trials and despite having no errors, the smartserver still ignore my request.
If someone have an idea about what is wrong with the request, it would help me a lot.
Thanks by advance
Regards,
Here is the SOAP request I made :
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:mes="http://wsdl.echelon.com/web_services_ns/ilon100/v4.0/message/">
<soapenv:Header>
<mes:messageProperties>
<!--Optional:-->
<mes:UCPTuniqueId>cid:38089712644</mes:UCPTuniqueId>
<!--Optional:-->
<mes:UCPTipAddress>192.168.1.222</mes:UCPTipAddress>
<!--Optional:-->
<mes:UCPTport>8080</mes:UCPTport>
</mes:messageProperties>
</soapenv:Header>
<soapenv:Body>
<mes:Set xmlns="http://wsdl.echelon.com/web_services_ns/ilon100/v4.0/message/">
<mes:iLonItem xsi:type="Item_Coll" xmlns:xsi="xsi">
<!--Zero or more repetitions:-->
<mes:Item xsi:type="Dp_Cfg" xmlns:xsi="xsi">
<mes:UCPTname>Net/LON/P68/OLC[0]/nviLampValue_1</mes:UCPTname>
<!--Optional:-->
<mes:UCPTannotation>Dp_In;xsi:type=\"LON_Dp_Cfg\"</mes:UCPTannotation>
<mes:UCPTbaseType LonFormat="#8000010128000000[4].UCPTbaseType">BT_STRUCT</mes:UCPTbaseType>
<UCPTformatDescription>#0000000000000000[0].SNVT_switch</UCPTformatDescription>
<mes:ValueDef>
<mes:UCPTindex>0</mes:UCPTindex>
<mes:UCPTname>OFF</mes:UCPTname>
<mes:UCPTvalue LonFormat='#0000000000000000[0].SNVT_switch'>0.0 0</mes:UCPTvalue>
</mes:ValueDef>
<mes:ValueDef>
<mes:UCPTindex>1</mes:UCPTindex>
<mes:UCPTname>ON</mes:UCPTname>
<mes:UCPTvalue LonFormat='#0000000000000000[0].SNVT_switch'>100.0 1</mes:UCPTvalue>
</mes:ValueDef>
<mes:ValueDef>
<mes:UCPTindex>2</mes:UCPTindex>
<mes:UCPTname>PRESET1</mes:UCPTname>
<mes:UCPTvalue LonFormat='#0000000000000000[0].SNVT_switch'>80.0 1</mes:UCPTvalue>
</mes:ValueDef>
</mes:Item>
</mes:iLonItem>
</mes:Set>
</soapenv:Body>
</soapenv:Envelope>
And here is the response of the smartserver (seems to indicate no error, but no processing too)
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Header>
<p:messageProperties xmlns:p="http://wsdl.echelon.com/web_services_ns/ilon100/v4.0/message/">
<p:UCPTtimeStamp>2022-01-10T17:33:18.040+01:00</p:UCPTtimeStamp>
<p:UCPTuniqueId>0300003B44F2</p:UCPTuniqueId>
<p:UCPTipAddress>192.168.1.222</p:UCPTipAddress>
<p:UCPTport>8080</p:UCPTport>
<p:UCPTlastUpdate>2022-01-10T16:23:36Z</p:UCPTlastUpdate>
<p:UCPTprocessingTime>21</p:UCPTprocessingTime>
</p:messageProperties>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<SetResponse xmlns="http://wsdl.echelon.com/web_services_ns/ilon100/v4.0/message/">
<iLonItem xsi:type="Item_Coll">
<UCPTfaultCount>0</UCPTfaultCount>
<UCPTcurrentConfig>4.0</UCPTcurrentConfig>
</iLonItem>
</SetResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Ok, I found a solution that seems to work. I share in case someone could face the same (or a similar) problem.
This is what I found that worked after sending the request using SOAPUI:
I had to edit the < Enveloppe >, < MessageProperties > and < Set > tags with the correct namespaces.
I also added more parameters in the tag but I didn't check if they are all necessary, except UCPTname, UCPTannotation, UCPTFormatDescription, UCPTDirection and UCPTbaseType and that are important to define the presets.
Regards,
Here is the request that worked for me :
<?xml version="1.0" encoding="utf-8"?>
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<Header>
<messageProperties xmlns="http://wsdl.echelon.com/web_services_ns/ilon100/v4.0/message/"/>
</Header>
<Body>
<Set xmlns="http://wsdl.echelon.com/web_services_ns/ilon100/v4.0/message/">
<iLonItem>
<Item xsi:type="Dp_Cfg">
<UCPTname>Net/LON/P68/OLC[0]/nviLampValue_1</UCPTname>
<UCPTannotation>Dp_In;xsi:type=\"LON_Dp_Cfg\"</UCPTannotation>
<UCPThidden>0</UCPThidden>
<UCPTformatDescription>#0000000000000000[0].SNVT_switch</UCPTformatDescription>
<UCPTlength>2</UCPTlength>
<UCPTdirection LonFormat="#8000010128000000[4].UCPTdirection">DIR_IN</UCPTdirection>
<UCPTbaseType LonFormat="#8000010128000000[4].UCPTbaseType">BT_STRUCT</UCPTbaseType>
<UCPTmaxFields>2</UCPTmaxFields>
<SCPTmaxSendTime>0</SCPTmaxSendTime>
<SCPTminSendTime>0</SCPTminSendTime>
<SCPTmaxRcvTime>0</SCPTmaxRcvTime>
<ValueDef>
<UCPTindex>0</UCPTindex>
<UCPTname>OFF</UCPTname>
<UCPTvalue LonFormat="#0000000000000000[0].SNVT_switch">0.0 0</UCPTvalue>
</ValueDef>
<ValueDef>
<UCPTindex>1</UCPTindex>
<UCPTname>ON</UCPTname>
<UCPTvalue LonFormat="#0000000000000000[0].SNVT_switch">100.0 1</UCPTvalue>
</ValueDef>
<ValueDef>
<UCPTindex>2</UCPTindex>
<UCPTname>PRESET1</UCPTname>
<UCPTvalue LonFormat="#0000000000000000[0].SNVT_switch">80.0 1</UCPTvalue>
</ValueDef>
</Item>
</iLonItem>
</Set>
</Body>
</Envelope>

SOAP request with certain tags without namespace

Would be the following SOAP request valid according to the standard?
<?xml version="1.0" encoding="utf-8"?>
<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>
<ns2:ServiceReq xmlns:ns2="http://www.tibco.com/service" xmlns:ns1="http://www.tibco.com/framework">
<ns1:HeaderIn>
<ns1:countryISO>FR</ns1:countryISO>
<ns1:callerDateTime>2021-11-26T15:50:08.742Z</ns1:callerDateTime>
</ns1:HeaderIn>
<ns2:request>
<entete>
<profile>Default</profile>
</entete>
<input>
<type>W</type>
<codeRegion>X</codeRegion>
</input>
</ns2:request>
</ns2:ServiceReq>
</soapenv:Body>
</soapenv:Envelope>
I am not sure because certain tags don't have a namespace
There are multiple levels of valid here:
Is it a valid SOAP message as per the SOAP standard? Yes. The SOAP envelope and body tags seem valid.
Is it a valid XML format? Yes, it's a well formed XML file.
Are those elements without a namespace prefix valid? Yes. Elements can be in a default namespace or in no namespace at all.
Is the actual content of the body a valid messages? You can only tell if you verify the message you posted against the expected message as defined in the WSDL file of the web service.
All the elements in the body of the SOAP message should belong to specific namespaces, but sometimes a developer forgets to add a namespace annotation on the element, or copy-pastes something from some place else, or whatever, and you end up with weird looking XMLs like that. The service works and the message is correctly parsed, but it just looks funny.

SuiteTalk SOAP API TransactionSearchBasic with type journalEntry fails

I tried fetching all the journal entries in my account using the SuiteTalk SOAP API.
But it fails with the message
The field type's enum value <journalEntry> is invalid for this
search.
The Request and Response are as follows:
==================== Beginning of Request ====================
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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>
<ns1:searchPreferences xmlns:ns1="urn:messages_2021_1.platform.webservices.netsuite.com" soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0">
<ns1:pageSize>20</ns1:pageSize>
</ns1:searchPreferences>
<ns2:tokenPassport xmlns:ns2="urn:messages_2021_1.platform.webservices.netsuite.com" soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0">
<ns3:account xmlns:ns3="urn:core_2021_1.platform.webservices.netsuite.com">#####</ns3:account>
<ns4:consumerKey xmlns:ns4="urn:core_2021_1.platform.webservices.netsuite.com">#####3</ns4:consumerKey>
<ns5:token xmlns:ns5="urn:core_2021_1.platform.webservices.netsuite.com">#####</ns5:token>
<ns6:nonce xmlns:ns6="urn:core_2021_1.platform.webservices.netsuite.com">#####</ns6:nonce>
<ns7:timestamp xmlns:ns7="urn:core_2021_1.platform.webservices.netsuite.com">#####</ns7:timestamp>
<ns8:signature xmlns:ns8="urn:core_2021_1.platform.webservices.netsuite.com" algorithm="HMAC-SHA256">#####</ns8:signature>
</ns2:tokenPassport>
</soapenv:Header>
<soapenv:Body>
<search xmlns="urn:messages_2021_1.platform.webservices.netsuite.com">
<searchRecord xmlns:ns9="urn:common_2021_1.platform.webservices.netsuite.com" xsi:type="ns9:TransactionSearchBasic">
<ns9:type xmlns:ns10="urn:core_2021_1.platform.webservices.netsuite.com" operator="anyOf" xsi:type="ns10:SearchEnumMultiSelectField">
<ns10:searchValue xsi:type="xsd:string">journalEntry</ns10:searchValue>
</ns9:type>
</searchRecord>
</search>
</soapenv:Body>
</soapenv:Envelope>
==================== End of Request ====================
==================== Beginning of Response ====================
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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_2021_1.platform.webservices.netsuite.com">
<platformMsgs:nsId>#####</platformMsgs:nsId>
</platformMsgs:documentInfo>
</soapenv:Header>
<soapenv:Body>
<searchResponse xmlns="urn:messages_2021_1.platform.webservices.netsuite.com">
<platformCore:searchResult xmlns:platformCore="urn:core_2021_1.platform.webservices.netsuite.com">
<platformCore:status isSuccess="true">
<platformCore:statusDetail type="WARN">
<platformCore:code>WARNING</platformCore:code>
<platformCore:message>The field type's enum value <journalEntry> is invalid for this search.</platformCore:message>
</platformCore:statusDetail>
</platformCore:status>
<platformCore:totalRecords>0</platformCore:totalRecords>
<platformCore:totalPages>0</platformCore:totalPages>
<platformCore:searchId>#####a</platformCore:searchId>
<platformCore:recordList/>
</platformCore:searchResult>
</searchResponse>
</soapenv:Body>
</soapenv:Envelope>
==================== End of Response ====================
The permissions for the role are as follows:
You should use the TransactionType enum ex in java:
SearchEnumMultiSelectField searchTypeValue = new SearchEnumMultiSelectField();
searchTypeValue.getSearchValue().add(TransactionType.JOURNAL.value());
The search type string should be "_journal":
<search xmlns="urn:messages_2021_1.platform.webservices.netsuite.com">
<searchRecord xmlns:ns9="urn:common_2021_1.platform.webservices.netsuite.com" xsi:type="ns9:TransactionSearchBasic">
<ns9:type xmlns:ns10="urn:core_2021_1.platform.webservices.netsuite.com" operator="anyOf" xsi:type="ns10:SearchEnumMultiSelectField">
<ns10:searchValue xsi:type="xsd:string">_journal</ns10:searchValue>
</ns9:type>
</searchRecord>
</search>
See https://www.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2021_1/schema/enum/transactiontype.html?mode=package and https://www.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2021_1/schema/search/transactionsearchbasic.html?mode=package
You should always use the Schema Browser to look these things up, since they can be different between different uses.
Depending on how you are generating the SOAP message, how you get the string can vary. If using C#, Visual Studio, and the proxy classes created from the WSDL, there should be an enum that gets you the right string values.
EDIT:
Specifically, the values are stored in a public enum called RecordType. In C#, RecordType.JournalEntry (which has an integer value of 94) will place "_journal" in the SOAP message.

How to get response value from Currency Converter service response through groovy script in SoapUI?

I'm using Currency Converter webservice to practice groovy script in SoapUI Pro.
In that, I have created a property that should get response / output of the Currency Converter service through groovy script.
For that, I tried the following script which gets all the raw response data :(
I need to get the exact result i.e. converted value and assign to the property.
Can anyone provide me the correct groovy script?
Request:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://www.webserviceX.NET/">
<soapenv:Header/>
<soapenv:Body>
<web:ConversionRate>
<web:FromCurrency>USD</web:FromCurrency>
<web:ToCurrency>INR</web:ToCurrency>
</web:ConversionRate>
</soapenv:Body>
</soapenv:Envelope>
Response:
<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>
<ConversionRateResponse xmlns="http://www.webserviceX.NET/">
<ConversionRateResult>60.54</ConversionRateResult>
</ConversionRateResponse>
</soap:Body>
</soap:Envelope>
Thanks
Karunagara Pandi
First you need access to the Response.
def conversionRateResult = context.expand( '${step_name#Response#//*:ConversionRateResult}' )
Then to assign it to a property depends on multiple things: 1) where are you doing it from, and 2) where do you want the property assigned.
To crawl the hierarchy from a script step, you would do something like:
testRunner.testCase.setPropertyValue("property_name", conversionRateResult)
Consider browsing through the documentation and API.

Adwords SOAP XML request against ManagedCustomerService fails

I'm working with https://adwords.google.com/api/adwords/mcm/v201402/ManagedCustomerService and wanting to get the account hierarchy.
The requests are being made in raw XML (controlled by JScript) -- a bit perverse, I know, but that's the situation.
I've generated the following SOAP packet
<?xml version="1.0" encoding="UTF-8"?>
<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>
<ns1:RequestHeader soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0" xmlns:ns1="https://adwords.google.com/api/adwords/mcm/v201402">
<ns1:clientCustomerId>some_ccid</ns1:clientCustomerId>
<ns1:developerToken>some_developer_token</ns1:developerToken>
<ns1:userAgent>GAS</ns1:userAgent>
<ns1:validateOnly>false</ns1:validateOnly>
<ns1:partialFailure>false</ns1:partialFailure>
</ns1:RequestHeader>
</soapenv:Header>
<soapenv:Body>
<get xmlns="https://adwords.google.com/api/adwords/mcm/v201402">
<serviceSelector>
<fields>Login</fields>
<fields>Customer</fields>
<fields>Name</fields>
<predicate>
<field>id</field>
<operator>GREATER_THAN</operator>
<values>0</values>
</predicate>
</serviceSelector>
</get>
</soapenv:Body>
</soapenv:Envelope>
Please note the idGREATER_THAN0. This is my naive way of getting everything.
I notice that the PHP GetAccountHierarchy.php has
// Create selector.
$selector = new Selector();
// Specify the fields to retrieve.
$selector->fields = array('Login', 'CustomerId', 'Name');
// Make the get request.
$graph = $managedCustomerService->get($selector);
This would seem to imply that no predicate has been defined. However, I'm a bit leery of doing that because the documentation says (yes, I do read the friendly manual), "predicates ContentsNotNull"
The response I get is
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<ns2:ResponseHeader xmlns:ns2="https://adwords.google.com/api/adwords/mcm/v201402" xmlns="https://adwords.google.com/api/adwords/cm/v201402">
<requestId>0004f553e08eaca00abc25900000893f</requestId>
<serviceName>ManagedCustomerService</serviceName>
<methodName>get</methodName>
<operations>0</operations>
<responseTime>141</responseTime>
</ns2:ResponseHeader>
</soap:Header>
<soap:Body>
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>[QuotaCheckError.INVALID_TOKEN_HEADER # ]</faultstring>
<detail>
<ns2:ApiExceptionFault xmlns="https://adwords.google.com/api/adwords/cm/v201402" xmlns:ns2="https://adwords.google.com/api/adwords/mcm/v201402">
<message>[QuotaCheckError.INVALID_TOKEN_HEADER # ]</message>
<ApplicationException.Type>ApiException</ApplicationException.Type>
<errors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="QuotaCheckError">
<fieldPath/>
<trigger/>
<errorString>QuotaCheckError.INVALID_TOKEN_HEADER</errorString>
<ApiError.Type>QuotaCheckError</ApiError.Type>
<reason>INVALID_TOKEN_HEADER</reason>
</errors>
</ns2:ApiExceptionFault>
</detail>
</soap:Fault>
</soap:Body>
</soap:Envelope>
What am I doing incorrectly that I should get such a response?
BTW, if I do leave out the predicate or specify it with a null content, I still get the QuotaCheckError.INVALID_TOKEN_HEADER error.
A solution has been provided on the Adwords API google group. Working nicely now!