After following the example Yang laid out here catered to our own needs, we keep getting a response code of 500. (see below for code samples of what is causing the 500, and maybe you can advise as to what changes we need to make)
Debugging this has been frustrating to say the least, as it appears we are doing everything correctly. Debugging tips and/or more detail on above example would be greatly appreciated!
Has anyone been able to successfully call a Web Service using a SOAP Envelope in SuiteScript? If so, please post some sample code in this thread.
Thanks,
John
Code Samples
The call:
response = nlapiRequestURL( ns_ws_url, request,a);
Soap Envelope request (in "request" variable) : <?xml version="1.0"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Header> <platformMsgs:applicationInfo xmlns: platformMsgs="urn:messages_2_5.platform.webservices.netsuite.com" xmlns: platformMsgs="urn:core_2_5.platform.webservices.netsuite.com"> </platformMsgs:applicationInfo> </SOAP-ENV:Header> <SOAP-ENV:Body> <platformMsgs:login> <platformMsgs: passport> <platformMsgs:email>xxxxxxxxxxx@xxxxxxx.com</platformMsgs:email> <platformMsgs: password>yyyyyyyy</platformMsgs: password> <platformMsgs:account>TSTDRV######</platformMsgs:account> <platformMsgs:role platformMsgs:internalId="3"></platformMsgs:role> </platformMsgs: passport> </platformMsgs:login> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
headers: a['SOAPAction'] = '"login"'; a['Content-Type']= "text/xml; charset=utf-8"; a['Accept']="application/soap+xml, application/dime, multipart/related, text/*"; a['Vary']="User-Agent"; a['Host']="webservices.netsuite.com"; a['Set-Cookie']="ACCOUNT=TSTDRV######"; a['Content-Length'] = request.length + '';
The request url: var ns_ws_url = 'https://webservices.netsuite.com/services/NetSuitePort_2_5';
The debugging info I did manage to get from the response object:
Code: 500
Headers:
0: Connection: close
1: Set-Cookie: NS_VER=2007.0.5; path=/
2: NS_RTIMER_COMPOSITE: 19946208:706172746E6572732D6A6176613030322E7376616C652E6E65746C65646765722E636F6D:80
3: Date: Wed, 01 Aug 2007 01:10:12 GMT
4: Content-Type: text/xml; charset=utf-8
5: Server: Oracle-Application-Server-10g
6: P3P: CP="CAO PSAa OUR BUS PUR"
7: Transfer-Encoding: chunked
8: null: HTTP/1.1 500 Internal Server Error
9: Vary: User-Agent
Body:
null
Error:
null