Geoserver WMS service with CQL fitler polygon retuns always 0 matched features - cql

I am trying to make a request with CQL filter intersects with a polygon that you can draw to my geoserver, but WFS service always returns 0 matched, I am using this configuration, and I am leaving an example polygon as filter.
{
'service': 'wfs',
'version': '2.0.0',
'typename': 'workspace:layer',
'request': 'GetFeature',
'startIndex' :0,
'count': 10,
'CQL_FILTER' : 'intersects(geom,POLYGON((-103.33516105156251 21.13532635981934,-103.28227802846054 21.132733146568928,-103.229979857529 21.12498218902883,-103.17884473812032 21.112159207316008,-103.129437648214 21.09440598406221,-103.08230394289987 21.071918752547948,-103.03796319974948 21.044945968778553,-102.99690338665144 21.013785495572105,-102.95957542220131 20.97878123388898,-102.92638819220429 20.94031924318721,-102.89770407845843 20.898823398443987,-102.87383504794745 20.854750636568248,-102.85503934209035 20.808585849193573,-102.84151879698065 20.76083648225345,-102.8334168167928 20.712026905295165,-102.83081701391326 20.662692615193333,-102.83374252101711 20.613374339803585,-102.84215597238499 20.564612107190598,-102.8559601443285 20.516939345418038,-102.87499923773628 20.47087707655628,-102.89906077950268 20.42692826660399,-102.92787811397666 20.385572390490132,-102.9611334505628 20.347260268283343,-102.99846142920335 20.31240922524045,-103.03945316163956 20.281398624429745,-103.08366070305235 20.25456581641679,-103.13060190588125 20.232202545947004,-103.17976560527028 20.214551850743995,-103.23061708365469 20.201805482504277,-103.28260376044557 20.19410187494658,-103.33516105156251 20.191524678402207,-103.38771834267946 20.19410187494658,-103.43970501947032 20.201805482504277,-103.49055649785474 20.214551850743995,-103.53972019724378 20.232202545947004,-103.58666140007269 20.25456581641679,-103.63086894148547 20.281398624429745,-103.67186067392169 20.31240922524045,-103.70918865256225 20.347260268283343,-103.74244398914837 20.385572390490132,-103.77126132362237 20.42692826660399,-103.79532286538875 20.47087707655628,-103.81436195879652 20.516939345418038,-103.82816613074004 20.564612107190598,-103.8365795821079 20.613374339803585,-103.83950508921177 20.662692615193333,-103.83690528633221 20.712026905295165,-103.82880330614438 20.76083648225345,-103.81528276103468 20.808585849193573,-103.79648705517758 20.854750636568244,-103.77261802466661 20.898823398443987,-103.74393391092073 20.94031924318721,-103.71074668092372 20.97878123388898,-103.67341871647359 21.013785495572105,-103.63235890337553 21.044945968778553,-103.58801816022518 21.071918752547948,-103.54088445491104 21.09440598406221,-103.49147736500471 21.112159207316008,-103.44034224559604 21.12498218902883,-103.38804407466449 21.132733146568928,-103.33516105156251 21.13532635981934)))',
'PROPERTYNAME': 'id,name'}
If I use the same polygon on WMS service 1.1.1, works perfectly.
This is the response:
"<?xml version="1.0" encoding="UTF-8"?><wfs:FeatureCollection xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:wfs="http://www.opengis.net/wfs/2.0" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:mapa_jalisco="mapajalisco" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" numberMatched="0" numberReturned="0" timeStamp="2017-03-29T22:35:42.807Z" xsi:schemaLocation="http://www.opengis.net/wfs/2.0 http://localhost:8181/geoserver/schemas/wfs/2.0/wfs.xsd mapajalisco http://localhost:8181/geoserver/mapa_jalisco/wfs?service=WFS&version=2.0.0&request=DescribeFeatureType&typeName=mapa_jalisco%3Amarginacion_municipios http://www.opengis.net/gml/3.2 http://localhost:8181/geoserver/schemas/gml/3.2.1/gml.xsd"/>"
Help me please.

Related

Attempt to create simple Contact gives error: PATCH requests require components to be updated

I am currently using SDK version 3.39.0 and version 0004 of the API_MKT_CONTACT service definition to create a new Contact in Marketing Cloud with the following code:
ContactOriginData contact =
ContactOriginData.builder()
.originOfContact(origin)
.originTimestamp(ZonedDateTime.now())
.externalContactID(pii.getId().toString())
.firstName(pii.getFirstName())
.lastName(pii.getLastName())
.language(pii.getLanguage())
.countryReg(pii.getRegion())
.build();
// use low level API as a work around for https://github.com/SAP/cloud-sdk/issues/156
ODataRequestUpdate contactRequest = service
.updateContactOriginData(contact)
.withHeader("Sap-Cuan-RequestTimestamp", getFormattedTime(System.currentTimeMillis()))
.withHeader("Sap-Cuan-SequenceId", "UpdatePatch")
.withHeader("Sap-Cuan-SourceSystemType", "EXT")
.withHeader("Sap-Cuan-SourceSystemId", "sdk-test")
.toRequest();
String servicePath = "/sap/opu/odata/SAP/API_MKT_CONTACT_SRV;v=0004";
ODataRequestBatch requestBatch = new ODataRequestBatch(servicePath, ODataProtocol.V2);
requestBatch.beginChangeset().addUpdate(contactRequest).endChangeset();
HttpClient httpClient = HttpClientAccessor.getHttpClient(destination);
ODataRequestResultMultipartGeneric batchResult = requestBatch.execute(httpClient);
Running this produces the following error:
{
"error": {
"code": "/IWFND/CM_MGW/096",
"message": {
"lang": "en",
"value": "PATCH requests require components to be updated"
},
"innererror": {
"application": {
"component_id": "CEC-MKT-DM-IC",
"service_namespace": "/SAP/",
"service_id": "API_MKT_CONTACT_SRV",
"service_version": "0004"
},
"transactionid": "3B63A2A6CC920630E0060492A51E7EE7",
"timestamp": "20210310210334.4378960",
"Error_Resolution": {
"SAP_Transaction": "For backend administrators: use ADT feed reader \"SAP Gateway Error Log\" or run transaction /IWFND/ERROR_LOG on SAP Gateway hub system and search for entries with the timestamp above for more details",
"SAP_Note": "See SAP Note 1797736 for error analysis (https://service.sap.com/sap/support/notes/1797736)",
"Batch_SAP_Note": "See SAP Note 1869434 for details about working with $batch (https://service.sap.com/sap/support/notes/1869434)"
},
"errordetails": []
}
}
}
However, if I execute a similar request in postman it works without issue:
Request Payload:
--batch
Content-Type: multipart/mixed; boundary=changeset
--changeset
Content-Type: application/http
Content-Transfer-Encoding: binary
PATCH ContactOriginData(ContactOrigin='<ContactOrigin>',ContactID='24D8F7F6-440D-44F8-A24B-552435477688') HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 172
Sap-Cuan-RequestTimestamp: '2021-03-10T14:07:00.000'
Sap-Cuan-SequenceId: UpdatePatch
Sap-Cuan-SourceSystemType: EXT
Sap-Cuan-SourceSystemId: postman-test
{"OriginDataLastChgUTCDateTime":"/Date(1615410479885)/","EmailAddress":"samantha.cook#theoasis.com","FirstName":"Samantha","LastName":"Cook","Country":"US","Language":"EN"}
--changeset--
--batch--
Response Payload:
--1D7E85E6BC66B34E61ACF0EF3964CBD90
Content-Type: multipart/mixed; boundary=1D7E85E6BC66B34E61ACF0EF3964CBD91
Content-Length: 430
--1D7E85E6BC66B34E61ACF0EF3964CBD91
Content-Type: application/http
Content-Length: 262
content-transfer-encoding: binary
HTTP/1.1 204 No Content
Content-Length: 0
dataserviceversion: 2.0
sap-message: {"code":"HPA_STAGING_AREA/037","message":"Payload is processed via staging area. See Import Monitor for details.","target":"","severity":"info","transition":false,"details":[]}
--1D7E85E6BC66B34E61ACF0EF3964CBD91--
--1D7E85E6BC66B34E61ACF0EF3964CBD90--
I should note that I have also tried using .replacingEntity() which doesn't work either and produces a completely different error:
Inline component is not defined or not allowed (HTTP PUT)
Is there something with the SDK that I am missing or not using correctly?
Any help would be appreciated!
Cheers!
To update an entity you should get it from the service first. That is regardless whether you are using:
PATCH which will update only changed fields
or PUT which will send the full entity object
Currently you are creating a new entity object via the builder: ContactOriginData.builder(). Instead, please use the corresponding getContactOriginDataByKey() method of your service to first retrieve the entity to update from the service. Actually many services will force you to do this to ensure you are always editing the latest version of your data. This often happens via ETags which the SDK will also handle for you automatically.
You can find more information about the update strategies from the SDK on the documentaiton.
Edit:
As you pointed out in the comments the actual goal is to create an entity and the specific service in question only allows PUT and PATCH to create objects.
In that case using replacingEntity() (which translates to PUT) should already work with your code. You can make PATCH work as well by replacing the builder approach with a constructor call + setter approach.

Protractor config file: cucumberOpts tags not taken individually or ignored

I'm using the following configuration file.
/*EC:201611*/
var featsLocation = 'features/';
var stepsLocation = 'steps/';
exports.config = {
params:{
authURL:'http://localhost:3333',
login:{
email:'',
passw:''
}
},
resultJsonOutputFile:'',
getPageTimeout: 60000,
allScriptsTimeout: 500000,
framework: 'custom',
frameworkPath: require.resolve('protractor-cucumber-framework'),
capabilities: {
'browserName': 'phantomjs',
'phantomjs.binary.path': '/srv/build/applications/phantomjs/bin/phantomjs'
},
specs: [
featsLocation+'ediRejects.feature'
, featsLocation+'shipmentValidation.feature'
],
baseUrl: '',
cucumberOpts: {
tags: ['#Smoke','#Intgr'],
require: [
stepsLocation+'ediRejects/ediRejects.spec.js'
, stepsLocation+'shipmentValidation/shipmentValidation.spec.js'
, stepsLocation+'appointmentsOverdue/appointmentsOverdue.spec.js'
, stepsLocation+'deliveryOverdue/deliveryOverdue.spec.js'
, stepsLocation+'cpLogin/cpLogin.spec.js'
, stepsLocation+'globalSearch/globalSearch.spec.js'
, './support/hooks.js'
],
monochrome: true,
strict: true,
plugin: "json"
},
};
/*EC:201611*/
As you can see I'm adding these tags: ['#Smoke','#Intgr'].
At the feature files, I placed the tags on top of the scenarios, like this...
Feature: EDI-Rejects
#Smoke
Scenario: Access Final Mile Application
Given I get authentication to use EDI Rejects widget at Final Mile Application
#Smoke
Scenario: Validate title and headers
When I am testing EDI Rejects widget on the Werner Final Mile URL
Then Check the EDI Rejects widget header name is "EDI Rejects"
And Check the EDI Rejects Column Header names are "Customer Name", "Contact Name", "Contact Number", "Reject Reason", "Rejected %", "Shipper Ref #"
#Intgr
Scenario Outline: Validate Global Search Feature
When I am testing Global Search Feature of the Werner Final Mile URL
Then Check the "<columnName>" search is Correct
Examples:
| columnName |
| Customer Name |
| Contact Name |
| Contact No |
| Reject Reason |
| Shipper Reference Number |
But when I execute I get this...
0 scenarios
0 steps
0m00.000s
Am I missing something?
Node version = v 7.2.0.
Protractor version = 4.0.10.
npm version = 3.10.9.
In addition I have noted that when I put the two tags in the same scenario block of the feature file, like this...
#Smoke
#Intgr
Scenario: Access Final Mile Application
Given I get authentication to use EDI Rejects widget at Final Mile Application
#Smoke
#Intgr
Scenario: Validate title and headers
When I am testing EDI Rejects widget on the Werner Final Mile URL
Then Check the EDI Rejects widget header name is "EDI Rejects"
And Check the EDI Rejects Column Header names are "Customer Name", "Contact Name", "Contact Number", "Reject Reason", "Rejected %", "Shipper Ref #"
#Intgr
Scenario Outline: Validate Global Search Feature
When I am testing Global Search Feature of the Werner Final Mile URL
Then Check the "Customer Name" search is Correct
#Smoke
Scenario Outline: Validate Communication Methods disabled functionality
When I am testing Appointments Overdue widget on the Werner Final Mile URL
Then Check the Appointments Overdue widget "Phone" Communication button is disabled if none of the agents segments are selected
The first two scenarios are picked by protractor, but the third and fourth is ignored. This doesn't work for me because not all my scenarios are smoke test and not all my scenarios are integration test.
UPDATE
I did what #Ram Pasala suggested. But Now with Cucumberjs2.0 I'm facing a new problem:
I'm using a package.json to run my scripts with the npm test command.
This was the "old" syntax that used to work:
protractor ./FM_IntTest_UI_conf.js --cucumberOpts.tags ~#ignore --cucumberOpts.tags #smoke,#rt,#sprint
Based on what the new cucumberjs doc says...
At Old cucumberjs
This: --cucumberOpts.tags ~#ignore --cucumberOpts.tags #smoke,#rt,#sprint
At cucumberjs2.0
Becomes: --cucumberOpts.tags 'not #ignore and (#smoke or #rt)'
So I tried:
protractor ./FM_IntTest_UI_conf.js --cucumberOpts.tags 'not #ignore and (#smoke or #rt)'
And to be more consistent with cucumberjs2.0 doc, I also tried:
protractor ./FM_IntTest_UI_conf.js --tags 'not #ignore and (#smoke or #rt)'
Neither Worked. For both I got the following error:
' was unexpected at this time.
C:\workspace> "C:\workspace\node_modules.bin\node.exe" "C:\workspace\node_modules.bin\..\protractor\bin\protractor"
./FM_IntTest_UI_conf.js ---tags 'not #ignor e and (#smoke or #rt)'
npm ERR! Test failed. See above for more details.
What is now the correct syntax?
UPDATE (20170613)
After trial and error I found out all the following:
The syntax must be using double quotes like this:
protractor ./FM_IntTest_UI_conf.js --tags "not #ignore and (#smoke or #rt)"
Cucumberjs documentation is incorrect.
To put this in a package.json, escape chars are neeeded:
"protractor ./FM_IntTest_UI_conf.js --tags \"not #ignore and (#smoke or #rt)\""
Couple of things here -
tags cli option accepts a string not array source-code. In cucumberJS versions less than 2.0 which is infact used by protractor-cucumber-framework module, you would have declare them like this to run both #Smoke or #Intgr scenarios -
cucumberOpts: {
tags: '#Smoke,#Intgr'
}
This should solve your problem for now.
But since Cucumber 2.0 onwards this would change. It is currently in RC(release-candidate) phase and soon protractor-cucumber-framework would support it, lot of breaking changes have been introduced one of which would impact tags expression. According to their official docs cucumber-tag-expression new style tags have been introduced which are much more readable:
cucumberOpts: {
tags: '#Smoke or #Intgr'
}
//complex tags would become somewhat like this-
cucumberOpts: {
tags: '(#Smoke or #Intgr) and (not #Regression)'
}

How to use wait-for-sync properly

For experiments with single node configuration I run ArangoDB with the command:
arangod --server.endpoint=tcp://0.0.0.0:8529 --server.disable-authentication=true --database.wait-for-sync=true
Then I do a few commands:
db._createDatabase("foo")
db._useDatabase("foo")
db._create("a")
db.a.properties()
Get the result:
{
"doCompact" : true,
"journalSize" : 33554432,
"isSystem" : false,
"isVolatile" : false,
"waitForSync" : false,
"keyOptions" : {
"type" : "traditional",
"allowUserKeys" : true
},
"indexBuckets" : 8
}
And where is my "waitForSync": true by default? Where do I do a mistake?
I can confirm your problem using ArangoDB 2.8.7 and the arangosh. This is a bug. If the same is done on the console (with --console), then it works.
From arangosh the request goes via the HTTP API and there the default of "false" for "waitForSync" is added, the command line option is ignored, which is the bug. I will make sure that this will be fixed in the next release of ArangoDB.
In the meantime, please add "waitForSync": true in all db._create calls in arangosh and all POST /_api/collection API calls via HTTP.

NetSuite Invoice Creation MLI_LOCATION_REQUIRED but invoice.location unsettable

Seems like most people are using the PHP Toolkit for NetSuite webservices interaction; I am not, but I'll paste the SOAP encoded request/response in the hopes someone can help (coughSuite Resourcescough).
I'm trying to create a new invoice with a single invoice item. I get the error:
Multi-location Inventory Error (MLI_LOCATION_REQUIRED): this transaction or its items must have locations.
However when I try to set the location on the invoice itself I get the error:
You do not have permissions to set a value for element location due to one of the following reasons: 1) The field is read-only; 2) An associated feature is disabled; 3) The field is available either when a record is created or updated, but not in both cases.
[1] pry(main)> invoice.add
D, [2014-12-19T16:47:19.997923 #13995] DEBUG -- : HTTPI GET request to webservices.sandbox.netsuite.com (net_http)
I, [2014-12-19T16:47:20.464235 #13995] INFO -- : SOAP request: https://webservices.sandbox.netsuite.com/services/NetSuitePort_2013_2
I, [2014-12-19T16:47:20.464378 #13995] INFO -- : SOAPAction: "add", Content-Type: text/xml;charset=UTF-8, Content-Length: 2568
D, [2014-12-19T16:47:20.464926 #13995] DEBUG -- : <?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:platformMsgs="urn:messages_2013_2.platform.webservices.netsuite.com" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:platformCore="urn:core_2013_2.platform.webservices.netsuite.com" xmlns:platformCommon="urn:common_2013_2.platform.webservices.netsuite.com" xmlns:listRel="urn:relationships_2013_2.lists.webservices.netsuite.com" xmlns:tranSales="urn:sales_2013_2.transactions.webservices.netsuite.com" xmlns:actSched="urn:scheduling_2013_2.activities.webservices.netsuite.com" xmlns:setupCustom="urn:customization_2013_2.setup.webservices.netsuite.com" xmlns:listAcct="urn:accounting_2013_2.lists.webservices.netsuite.com" xmlns:tranBank="urn:bank_2013_2.transactions.webservices.netsuite.com" xmlns:tranCust="urn:customers_2013_2.transactions.webservices.netsuite.com" xmlns:tranInvt="urn:inventory_2013_2.transactions.webservices.netsuite.com" xmlns:listSupport="urn:support_2013_2.lists.webservices.netsuite.com" xmlns:tranGeneral="urn:general_2013_2.transactions.webservices.netsuite.com" xmlns:listMkt="urn:marketing_2013_2.lists.webservices.netsuite.com" xmlns:listWebsite="urn:website_2013_2.lists.webservices.netsuite.com" xmlns:fileCabinet="urn:filecabinet_2013_2.documents.webservices.netsuite.com" xmlns:listEmp="urn:employees_2013_2.lists.webservices.netsuite.com">
<env:Header>
<platformMsgs:passport>
<platformCore:email>[REDACTED]</platformCore:email>
<platformCore:password>[REDACTED]</platformCore:password>
<platformCore:account>[REDACTED]</platformCore:account>
<platformCore:role internalId="3"/>
</platformMsgs:passport>
</env:Header>
<env:Body>
<platformMsgs:add>
<platformMsgs:record xsi:type="tranSales:Invoice">
<tranSales:email>[REDACTED]</tranSales:email>
<tranSales:isTaxable>false</tranSales:isTaxable>
<tranSales:entity internalId="26017" externalId="[REDACTED]" type="customer"/>
<tranSales:itemList>
<tranSales:item>
<tranSales:item internalId="152"/>
<tranSales:line>1</tranSales:line>
<tranSales:orderLine>1</tranSales:orderLine>
<tranSales:amount>313</tranSales:amount>
<tranSales:location internalId="1" type="location"/>
<tranSales:revRecStartDate>2014-12-01T08:13:00.000Z</tranSales:revRecStartDate>
<tranSales:revRecEndDate>2015-12-01T08:13:00.000Z</tranSales:revRecEndDate>
</tranSales:item>
</tranSales:itemList>
</platformMsgs:record>
</platformMsgs:add>
</env:Body>
</env:Envelope>
D, [2014-12-19T16:47:20.465337 #13995] DEBUG -- : HTTPI POST request to webservices.sandbox.netsuite.com (net_http)
I, [2014-12-19T16:47:23.786293 #13995] INFO -- : SOAP response (status 200)
D, [2014-12-19T16:47:23.786660 #13995] DEBUG -- : <?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>
<platformMsgs:documentInfo xmlns:platformMsgs="urn:messages_2013_2.platform.webservices.netsuite.com">
<platformMsgs:nsId>WEBSERVICES_[REDACTED]_121920141668433096579618905_1be2c0a823e5</platformMsgs:nsId>
</platformMsgs:documentInfo>
</soapenv:Header>
<soapenv:Body>
<addResponse xmlns="urn:messages_2013_2.platform.webservices.netsuite.com">
<writeResponse>
<platformCore:status xmlns:platformCore="urn:core_2013_2.platform.webservices.netsuite.com" isSuccess="false">
<platformCore:statusDetail type="ERROR">
<platformCore:code>MLI_REQD</platformCore:code>
<platformCore:message>Multi-location Inventory Error (MLI_LOCATION_REQUIRED): this transaction or its items must have locations.</platformCore:message>
</platformCore:statusDetail>
<platformCore:statusDetail type="WARN">
<platformCore:code>WARNING</platformCore:code>
<platformCore:message>Fake Billing Line Item: You have only 0 available across all locations (0 back ordered, 0 on order).</platformCore:message>
</platformCore:statusDetail>
</platformCore:status>
</writeResponse>
</addResponse>
</soapenv:Body>
</soapenv:Envelope>
=> false
[2] pry(main)> invoice.location = ottawa
=> #<NetSuite::Records::Location:0x007fca96a5eea8
#attributes=
{:name=>"Ottawa",
:is_inactive=>false,
:addressee=>"Ottawa",
:addr1=>"[REDACTED]",
:city=>"Ottawa",
:state=>"ON",
:zip=>"[REDACTED]",
:country=>"_canada",
:addr_text=>"Ottawa\n[REDACTED]\nOttawa ON [REDACTED]",
:override=>false,
:make_inventory_available=>false},
#external_id=nil,
#internal_id="1">
[3] pry(main)> invoice.add
D, [2014-12-19T16:48:03.626321 #13995] DEBUG -- : HTTPI GET request to webservices.sandbox.netsuite.com (net_http)
I, [2014-12-19T16:48:04.090118 #13995] INFO -- : SOAP request: https://webservices.sandbox.netsuite.com/services/NetSuitePort_2013_2
I, [2014-12-19T16:48:04.090331 #13995] INFO -- : SOAPAction: "add", Content-Type: text/xml;charset=UTF-8, Content-Length: 2640
D, [2014-12-19T16:48:04.090841 #13995] DEBUG -- : <?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:platformMsgs="urn:messages_2013_2.platform.webservices.netsuite.com" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:platformCore="urn:core_2013_2.platform.webservices.netsuite.com" xmlns:platformCommon="urn:common_2013_2.platform.webservices.netsuite.com" xmlns:listRel="urn:relationships_2013_2.lists.webservices.netsuite.com" xmlns:tranSales="urn:sales_2013_2.transactions.webservices.netsuite.com" xmlns:actSched="urn:scheduling_2013_2.activities.webservices.netsuite.com" xmlns:setupCustom="urn:customization_2013_2.setup.webservices.netsuite.com" xmlns:listAcct="urn:accounting_2013_2.lists.webservices.netsuite.com" xmlns:tranBank="urn:bank_2013_2.transactions.webservices.netsuite.com" xmlns:tranCust="urn:customers_2013_2.transactions.webservices.netsuite.com" xmlns:tranInvt="urn:inventory_2013_2.transactions.webservices.netsuite.com" xmlns:listSupport="urn:support_2013_2.lists.webservices.netsuite.com" xmlns:tranGeneral="urn:general_2013_2.transactions.webservices.netsuite.com" xmlns:listMkt="urn:marketing_2013_2.lists.webservices.netsuite.com" xmlns:listWebsite="urn:website_2013_2.lists.webservices.netsuite.com" xmlns:fileCabinet="urn:filecabinet_2013_2.documents.webservices.netsuite.com" xmlns:listEmp="urn:employees_2013_2.lists.webservices.netsuite.com">
<env:Header>
<platformMsgs:passport>
<platformCore:email>[REDACTED]</platformCore:email>
<platformCore:password>[REDACTED]</platformCore:password>
<platformCore:account>[REDACTED]</platformCore:account>
<platformCore:role internalId="3"/>
</platformMsgs:passport>
</env:Header>
<env:Body>
<platformMsgs:add>
<platformMsgs:record xsi:type="tranSales:Invoice">
<tranSales:email>[REDACTED]</tranSales:email>
<tranSales:isTaxable>false</tranSales:isTaxable>
<tranSales:entity internalId="26017" externalId="[REDACTED]" type="customer"/>
<tranSales:itemList>
<tranSales:item>
<tranSales:item internalId="152"/>
<tranSales:line>1</tranSales:line>
<tranSales:orderLine>1</tranSales:orderLine>
<tranSales:amount>313</tranSales:amount>
<tranSales:location internalId="1" type="location"/>
<tranSales:revRecStartDate>2014-12-01T08:13:00.000Z</tranSales:revRecStartDate>
<tranSales:revRecEndDate>2015-12-01T08:13:00.000Z</tranSales:revRecEndDate>
</tranSales:item>
</tranSales:itemList>
<tranSales:location internalId="1" type="location"/>
</platformMsgs:record>
</platformMsgs:add>
</env:Body>
</env:Envelope>
D, [2014-12-19T16:48:04.091365 #13995] DEBUG -- : HTTPI POST request to webservices.sandbox.netsuite.com (net_http)
I, [2014-12-19T16:48:05.738270 #13995] INFO -- : SOAP response (status 200)
D, [2014-12-19T16:48:05.738785 #13995] DEBUG -- : <?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>
<platformMsgs:documentInfo xmlns:platformMsgs="urn:messages_2013_2.platform.webservices.netsuite.com">
<platformMsgs:nsId>WEBSERVICES_[REDACTED]_121920141668476805866012724_a7c7c427c826</platformMsgs:nsId>
</platformMsgs:documentInfo>
</soapenv:Header>
<soapenv:Body>
<addResponse xmlns="urn:messages_2013_2.platform.webservices.netsuite.com">
<writeResponse>
<platformCore:status xmlns:platformCore="urn:core_2013_2.platform.webservices.netsuite.com" isSuccess="false">
<platformCore:statusDetail type="ERROR">
<platformCore:code>INSUFFICIENT_PERMISSION</platformCore:code>
<platformCore:message>You do not have permissions to set a value for element location due to one of the following reasons: 1) The field is read-only; 2) An associated feature is disabled; 3) The field is available either when a record is created or updated, but not in both cases.</platformCore:message>
</platformCore:statusDetail>
</platformCore:status>
</writeResponse>
</addResponse>
</soapenv:Body>
</soapenv:Envelope>
=> false
[4] pry(main)>
Looking at the "invoice.location" JSON Data ([2] pry(main)> invoice.location = ottawa) posted in your question, i see you have "make_inventory_available" field set as false on the Location Record inside of NetSuite.
Could you try the below and let me know if it works:
In NetSuite User Interface, Navigate to Setup -> Company -> Locations (under Classifications).
Edit the Location with Internal Id "1" i.e. "Ottawa".
Set the Checkbox Field "MAKE INVENTORY AVAILABLE" to true.
Now try performing the invoice.add operation by setting the location field on Item Level as posted in your first soap xml request ([1] pry(main)> invoice.add).

Management API - The request body XML was invalid or not correctly specified

Cross posting from http://social.msdn.microsoft.com/Forums/en-US/windowsazuretroubleshooting/thread/31b6aedc-c069-4e32-8e8f-2ff4b7c30793
I'm getting this error on changing configuration through the service management API: The request body XML was invalid or not correctly specified
The request body payload:
<?xml version="1.0" encoding="utf-8"?>
<ChangeConfiguration xmlns="http://schemas.microsoft.com/windowsazu
re">
<Configuration>PD94bWwgdmVyc2lvbj0iMS4wIj8+CjxTZXJ2aWNlQ29uZmlndX
JhdGlvbiB4bWxuczp4c2k9Imh0dHA6Ly93d3cudzMub3JnLzIwMDEvWE1MU2NoZW1hLWluc3RhbmNlIi
B4bWxuczp4c2Q9Imh0dHA6Ly93d3cudzMub3JnLzIwMDEvWE1MU2NoZW1hIiB4bWxucz0iaHR0cDovL3
NjaGVtYXMubWljcm9zb2Z0LmNvbS9TZXJ2aWNlSG9zdGluZy8yMDA4LzEwL1NlcnZpY2VDb25maWd1cm
F0aW9uIiBzZXJ2aWNlTmFtZT0iIiBvc0ZhbWlseT0iMSIgb3NWZXJzaW9uPSIqIj4KICA8Um9sZSBuYW
1lPSJXZWJSb2xlMSI+CiAgICA8Q29uZmlndXJhdGlvblNldHRpbmdzPgogICAgICA8U2V0dGluZyBuYW
1lPSJNaWNyb3NvZnQuV2luZG93c0F6dXJlLlBsdWdpbnMuRGlhZ25vc3RpY3MuQ29ubmVjdGlvblN0cm
luZyIgdmFsdWU9IlVzZURldmVsb3BtZW50U3RvcmFnZT10cnVlIi8+CiAgICA8L0NvbmZpZ3VyYXRpb2
5TZXR0aW5ncz4KICAgIDxJbnN0YW5jZXMgY291bnQ9IjIiLz4KICAgIDxDZXJ0aWZpY2F0ZXMvPgogID
wvUm9sZT4KPC9TZXJ2aWNlQ29uZmlndXJhdGlvbj4K</Configuration>
</ChangeConfiguration>
I'm passing it the following configuration:
$configuration = '<?xml version="1.0" encoding="utf-8"?>
<ServiceConfiguration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" serviceName="" osFamily="1" osVersion="*">
<Role name="WebRole1">
<ConfigurationSettings>
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="UseDevelopmentStorage=true"/>
</ConfigurationSettings>
<Instances count="2"/>
<Certificates/>
</Role>
</ServiceConfiguration>';
Does anyone know why this error occurs? I suspect it has something to do with encoding but not sure.
Are you getting this directly from the call to the API? If so, it should be coming back with a x-ms-requestid header.
If you take that and call out to
https://management.core.windows.net/<subscriptionID/operations/<requestId>
This should give you a much more detailed message about what is going on, usually telling you exactly what is going on.
Outside of that, I'd check the following:
1.) Check your encoding, then check it again. I only mention this because when I first wrapped the API I had an issue where my encoding was screwing something up. So what I finally did was write a bit of code that would read the file, encode it, decode that, save that to a new file. Then binary compare the two. I finally found they were different by a single byte and it broke the whole thing.
2.) Check your config. Upload that exact config file to your role via the portal and see if its accepted.
3.) Check API version header. Not sure on the SDK for PHP, but if possible can you explicitly check/set the x-ms-version header being sent to the api?
4.) Cause a valid failure, and reverse engineer from there. If all else fails, pass in a blank or random/invalid encoded string. Then use the GetOperationStatus endpoint to ensure you are getting errors to the tune of "Configuration is invalid". This way you know your request is being accepted, but the encoding/configuration is throwing an error.
EDIT: from your reply here and MSDN
5.) Try omitting the XML Declaration
<?xml version="1.0" encoding="utf-8"?>
from the request body.
When I run your exact request vs the same request created by my own .net api wrapper, the only difference is that XML declaration is not in the body of the POST. The wrapper-generated class works for me.
Thanks everyone! I've been reverse-engineering what the csmanage.exe sends over the wire, and it works now. Here's why:
Steve Marx' "/" solution (http://social.msdn.microsoft.com/Forums/en-US/windowsazuretroubleshooting/thread/31b6aedc-c069-4e32-8e8f-2ff4b7c30793?prof=required) was required (it should be: //services/hostedservices/phptest1/deploymentslots/production/?comp=config)
I removed the XML declaration
I had to replace all newlines in my XML and make it a one-liner
As a side note: I noticed there's a "x-ms-version: 2010-04-01" in csmanage.exe. Any news/docs on that version?
PS: This will end up in the Windows Azure SDK for PHP if you want to see it working
1) Getting the config from Azure as ASCII (?), uploading it again as ASCII fails, uploading it as UTF-8 fails as well.
2) Works
3) Works
4) All I get is this lausy error (should create a T-Shirt from that :-)): "The request body XML was invalid or not correctly specified", even when passing it an ampty XML.
For the record: RAW request and response are:
-----------------------
Request
-----------------------
object(Microsoft_Http_Client)#3 (15) {
["adapter:protected"]=>
object(Microsoft_Http_Client_Adapter_Socket)#5 (6) {
["socket:protected"]=>
NULL
["connected_to:protected"]=>
array(2) {
[0]=>
NULL
[1]=>
NULL
}
["out_stream:protected"]=>
NULL
["config:protected"]=>
array(15) {
["persistent"]=>
bool(false)
["ssltransport"]=>
string(3) "ssl"
["sslcert"]=>
string(51) "C:\Projects\Workspaces\Default\Azure\management.pem"
["sslpassphrase"]=>
string(11) "*************"
["maxredirects"]=>
int(5)
["strictredirects"]=>
bool(false)
["useragent"]=>
string(21) "Microsoft_Http_Client"
["timeout"]=>
int(10)
["httpversion"]=>
string(3) "1.1"
["keepalive"]=>
bool(false)
["storeresponse"]=>
bool(true)
["strict"]=>
bool(true)
["output_stream"]=>
bool(false)
["sslusecontext"]=>
bool(true)
}
["method:protected"]=>
string(3) "POST"
["_context:protected"]=>
resource(38) of type (stream-context)
}
["uri:protected"]=>
object(Microsoft_Uri_Http)#10 (9) {
["_username:protected"]=>
string(0) ""
["_password:protected"]=>
string(0) ""
["_host:protected"]=>
string(27) "management.core.windows.net"
["_port:protected"]=>
int(443)
["_path:protected"]=>
string(97) "/******************/services/hostedservices/phptest1/deploymentslots/production"
["_query:protected"]=>
string(11) "comp=config"
["_fragment:protected"]=>
string(0) ""
["_scheme:protected"]=>
string(5) "https"
}
["headers:protected"]=>
array(3) {
["content-type"]=>
array(2) {
[0]=>
string(12) "Content-Type"
[1]=>
string(15) "application/xml"
}
["expect"]=>
array(2) {
[0]=>
string(6) "Expect"
[1]=>
string(0) ""
}
["x-ms-version"]=>
array(2) {
[0]=>
string(12) "x-ms-version"
[1]=>
string(10) "2009-10-01"
}
}
["method:protected"]=>
string(3) "POST"
["paramsGet:protected"]=>
array(0) {
}
["paramsPost:protected"]=>
array(0) {
}
["enctype:protected"]=>
NULL
["raw_post_data:protected"]=>
string(965) "<?xml version="1.0" encoding="utf-8"?>
<ChangeConfiguration xmlns="http://schemas.microsoft.com/windowsazure">
<Configuration>PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPFNlcnZpY2VDb25maWd1cmF0aW9uIHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiIHhtbG5zOnhzZD0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEiIHhtbG5zPSJodHRwOi8vc2NoZW1hcy5taWNyb3NvZnQuY29tL1NlcnZpY2VIb3N0aW5nLzIwMDgvMTAvU2VydmljZUNvbmZpZ3VyYXRpb24iIHNlcnZpY2VOYW1lPSIiIG9zRmFtaWx5PSIxIiBvc1ZlcnNpb249IioiPgogIDxSb2xlIG5hbWU9IldlYlJvbGUxIj4KICAgIDxDb25maWd1cmF0aW9uU2V0dGluZ3M+CiAgICAgIDxTZXR0aW5nIG5hbWU9Ik1pY3Jvc29mdC5XaW5kb3dzQXp1cmUuUGx1Z2lucy5EaWFnbm9zdGljcy5Db25uZWN0aW9uU3RyaW5nIiB2YWx1ZT0iVXNlRGV2ZWxvcG1lbnRTdG9yYWdlPXRydWUiLz4KICAgIDwvQ29uZmlndXJhdGlvblNldHRpbmdzPgogICAgPEluc3RhbmNlcyBjb3VudD0iMiIvPgogICAgPENlcnRpZmljYXRlcy8+CiAgPC9Sb2xlPgo8L1NlcnZpY2VDb25maWd1cmF0aW9uPgo=</Configuration>
</ChangeConfiguration>"
["auth:protected"]=>
NULL
["files:protected"]=>
array(0) {
}
["cookiejar:protected"]=>
NULL
["last_request:protected"]=>
NULL
["last_response:protected"]=>
NULL
["redirectCounter:protected"]=>
int(0)
}
-----------------------
Response
-----------------------
object(Microsoft_Http_Response)#9 (5) {
["version:protected"]=>
string(3) "1.1"
["code:protected"]=>
int(400)
["message:protected"]=>
string(11) "Bad Request"
["headers:protected"]=>
array(5) {
["Content-length"]=>
string(3) "230"
["Content-type"]=>
string(30) "application/xml; charset=utf-8"
["Server"]=>
string(21) "Microsoft-HTTPAPI/2.0"
["Date"]=>
string(29) "Thu, 17 Feb 2011 07:15:36 GMT"
["Connection"]=>
string(5) "close"
}
["body:protected"]=>
string(230) "<Error xmlns="http://schemas.microsoft.com/windowsazure" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><Code>InvalidXmlRequest</Code><Message>The request body’s XML was invalid or not correctly specified.</Message></Error>"
}

Resources