I have a current requirement where I need to make a soap call to retrieve the data for further business intelligence. I have no experience in SOAP.
The service call is called getSiteInfo.
getSiteInfo has following 4 parameters- userName, password, custNbr, siteId.
Now I can make calls like this and it generates an xml response
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:bil="http://billing.xyz.cc/">
<soapenv:Header/>
<soapenv:Body>
<bil:getSiteInfo>
<!--userName:-->
<arg0>username</arg0>
<!--password:-->
<arg1>pswd</arg1>
<!--custNbr:-->
<arg2>288</arg2>
<!--siteId:-->
<arg3>0862578</arg3>
</bil:getSiteInfo>
</soapenv:Body>
</soapenv:Envelope>
I was wondering is it possible to include multiple siteId in the same call instead of doing it repeatedly for almost 1000+ siteIds.
I tried the following two to see if they work and none of them did. It only returned the response for the last item; 108952 in this case.
Method1
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:bil="http://billing.xyz.cc/">
<soapenv:Header/>
<soapenv:Body>
<bil:getSiteInfo>
<!--userName:-->
<arg0>username</arg0>
<!--password:-->
<arg1>pswd</arg1>
<!--customerNumber:-->
<arg2>288</arg2>
<!--siteNumber:-->
<arg3>0862578</arg3>
<arg3>108952</arg3>
</bil:getSiteInfo>
</soapenv:Body>
</soapenv:Envelope>
Method2
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:bil="http://billing.xyz.cc/">
<soapenv:Header/>
<soapenv:Body>
<bil:getSiteInfo>
<!--userName:-->
<arg0>username</arg0>
<!--password:-->
<arg1>pswd</arg1>
<!--customerNumber:-->
<arg2>288</arg2>
<!--siteNumber:-->
<arg3>108952</arg3>
</bil:getSiteInfo>
<bil:getSiteInfo>
<!--userName:-->
<arg0>username</arg0>
<!--password:-->
<arg1>pswd</arg1>
<!--customerNumber:-->
<arg2>288</arg2>
<!--siteNumber:-->
<arg3>0862578</arg3>
</bil:getSiteInfo>
</soapenv:Body>
</soapenv:Envelope>
Thank you very much in advance.
Related
I am trying to get the metadata/fields of the custom forms in Netsuite. But the documentation of netsuite does not provide any direct way of doing this. Some pages mentioned using the SOAP Api's, So i tried using the SOAP api. Here is my api request in SOAP.
<?xml version="1.0"?>
<soapenv:Envelope
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soapenv:Header>
<ns1:searchPreferences
xmlns:ns1="urn:messages_2022_1.platform.webservices.netsuite.com" soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0">
<ns1:pageSize>30</ns1:pageSize>
</ns1:searchPreferences>
<ns2:tokenPassport soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0"
xmlns:ns2="urn:messages_2022_1.platform.webservices.netsuite.com">
<ns3:account
xmlns:ns3="urn:core_2022_1.platform.webservices.netsuite.com">{{ACCOUNT}}
</ns3:account>
<ns4:consumerKey
xmlns:ns4="urn:core_2022_1.platform.webservices.netsuite.com">{{CONSUMER_KEY}}
</ns4:consumerKey>
<ns5:token
xmlns:ns5="urn:core_2022_1.platform.webservices.netsuite.com">{{TOKEN_ID}}
</ns5:token>
<ns6:nonce
xmlns:ns6="urn:core_2022_1.platform.webservices.netsuite.com">{{nonce}}
</ns6:nonce>
<ns7:timestamp
xmlns:ns7="urn:core_2022_1.platform.webservices.netsuite.com">{{timestamp}}
</ns7:timestamp>
<ns8:signature
xmlns:ns8="urn:core_2022_1.platform.webservices.netsuite.com" algorithm="HMAC-SHA256">{{signature}}
</ns8:signature>
</ns2:tokenPassport>
</soapenv:Header>
<soapenv:Body>
<getSelectValue>
<fieldDescription
xmlns:platformCore="urn:core_2022_1.platform.webservices.netsuite.com">
<platformCore:recordType>salesOrder</platformCore:recordType>
<platformCore:sublist
xmlns="urn:core_2022_1.platform.webservices.netsuite.com">customForm
</platformCore:sublist>
<platformCore:field>salesOrder</platformCore:field>
<platformCore:filterByValueList>
<platformCore:filterBy>
<platformCore:field>entity</platformCore:field>
<platformCore:internalId>164</platformCore:internalId>
</platformCore:filterBy>
</platformCore:filterByValueList>
</fieldDescription>
<pageIndex>1</pageIndex>
</getSelectValue>
</soapenv:Body>
</soapenv:Envelope>
The authorization and the signature generation are working correctly and it return actual response from netsuite. The response contains the list of all custom forms, but not the metadata/fields of the form i put in the filter part.
If there is any other way to do this let me know.
I want to get this request sample :
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsdl="http://crimsonlogic.com/enotary/notaryFee"> <soapenv:Header> <wsdl:RequestHeader> <wsdl:transactionId>ABC12344555</wsdl:transactionId> <wsdl:serviceProviderEntity>ABCD</wsdl:serviceProviderEntity> </wsdl:RequestHeader> </soapenv:Header> <soapenv:Body> <wsdl:retrieveNotaryFees_MOJRequest"
but i get only body tag without header
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.
I'm calling a soap web service that is very strict on the request from inside an asp.net core API.
by overriding OnWriteStartBody,OnWriteBodyContents,OnWriteStartEnvelope methods in the System.ServiceModel.Channels.Message class.
my XML
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="http://POWebservice/">
<soapenv:Body>
<ns1:myaction
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<trantype>purchase</trantype>
<tranamount>94999.23</tranamount>
</ns1:myaction>
</soapenv:Body>
</soapenv:Envelope>
what they expect :
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="http://POWebservice/">
<soapenv:Body>
<ns1:myaction>
<trantype>purchase</trantype>
<tranamount>94999.23</tranamount>
</ns1:myaction>
</soapenv:Body>
</soapenv:Envelope>
i want to get rid of xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
I have been able to modify some of the payload using
protected override void OnWriteStartEnvelope(XmlDictionaryWriter writer)
{
writer.WriteStartElement("soapenv", "Envelope", "http://schemas.xmlsoap.org/soap/envelope/");
}
i have also attempted to implement the IClientMessageInspector but the intercepted message in BeforeSendRequest had only the header and not the body. plus it had too many hacks .
I am attempting to POST using Postman to the Cybersource Simple Order API, but it comes back with a no header error when doing so. What am I doing wrong here? Since the merchant ID is used as the username, what is used as the password, should this be the Simple Order transaction processing key?
Posting the following XML data to the test endpoint (https://ics2wstesta.ic3.com/commerce/1.x/transactionProcessor):
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header>
<wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext1.0.xsd">
<wsse:UsernameToken>
<wsse:Username>merchantname</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile1.0#PasswordText">key</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
<requestMessage xmlns="urn:schemas-cybersource-com:transaction-data-1.150">
<merchantID>merchantname</merchantID>
<merchantReferenceCode>12345678912</merchantReferenceCode>
<recurringSubscriptionInfo>
<subscriptionID>12345678901234567890</subscriptionID>
</recurringSubscriptionInfo>
<paySubscriptionDeleteService run="true"/>
</requestMessage>
</soapenv:Body>
</soapenv:Envelope>
You have a small error in your namespaces. You missed a "-".
oasis-200401-wss-wssecurity-secext1.0.xsd
should be
oasis-200401-wss-wssecurity-secext-1.0.xsd
and
oasis-200401-wss-username-token-profile1.0#PasswordText
should be
oasis-200401-wss-username-token-profile-1.0#PasswordText