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!
Related
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>
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 am new to Salesforce metadata api. I want to create a listview of contacts on Salesforce using metadata api.
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:met="http://soap.sforce.com/2006/04/metadata">
<soap:Header>
<met:AllOrNoneHeader>
<met:allOrNone>false</met:allOrNone>
</met:AllOrNoneHeader>
<met:CallOptions>
<met:client>https://xyz.salesforce.com</met:client>
</met:CallOptions>
<met:SessionHeader>
<met:sessionId>xyz</met:sessionId>
</met:SessionHeader>
</soap:Header>
<soap:Body>
<met:createMetadata>
<!--Zero or more repetitions:-->
<met:metadata>
<!--Optional:-->
<met:fullName>TESTVIEW__c</met:fullName>
</met:metadata>
</met:createMetadata>
</soap:Body>
</soap:Envelope>
I am getting
[
{
"errorCode": "METHOD_NOT_ALLOWED",
"message": "HTTP Method 'POST' not allowed. Allowed are HEAD,GET"
}
]
The endpoint I use is:
https://xyz.salesforce.com/services/data/v51.0/sobjects/Contact/listviews
I updated to SOAP endpoint:
https://xyz-dev-ed.my.salesforce.com/services/Soap/m/51.0/1112312DRED21
Now I am getting
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<soapenv:Fault>
<faultcode>soapenv:Client</faultcode>
<faultstring>content-type of the request should be text/xml</faultstring>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
I guess I am one step closer. Is the payload valid for creation of contact listview?
You can't do a Metadata API deployment by making a POST to the REST API endpoint.
If you want to use a REST endpoint, use the REST deployRequest endpoint. If you want to use the SOAP createMetadata() call to which your payload appears to be oriented, you need to use the SOAP API.
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.
So i'm trying to fetch all the calendar event from office360.com . I am using ews to get the data. I sent a request of
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<soap:Body>
<FindItem xmlns="http://schemas.microsoft.com/exchange/services/2006/messages"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"
Traversal="Shallow">
<ItemShape>
<t:BaseShape>AllProperties</t:BaseShape>
<t:BodyType>HTML</t:BodyType>
</ItemShape>
<ParentFolderIds>
<t:DistinguishedFolderId Id="calendar"/>
</ParentFolderIds>
</FindItem>
</soap:Body>
</soap:Envelope>
This soap request xml is not returning me the calendar message body but i get the subject and other data . What am i doing wrong here ? any help is appreciated.
The body needs to be retrieved in a separate call.
http://weblogs.asp.net/psperanza/archive/2008/03/18/getting-calendar-items-using-exchange-web-services.aspx
Or you can load the property first.
http://blogs.msdn.com/b/exchangedev/archive/2010/03/16/loading-properties-for-multiple-items-with-one-call-to-exchange-web-services.aspx
The second is easier but you need to define all properties you want back and if it is a lot, it can be a pain.