Hi,
I tried searching the forum with a key word of nlapiRequestURL but I get a return of 0 results saying the words I used is too general...no comment there.
So, I'm trying to send xml string to a web service using SOAP in XML format. I'm getting a returned server response of " soap:ClientUnable to handle request without a valid action parameter. Please supply a valid soap action."
This is the first time I'm using nlapiRequestURL.
Any help is much appreciated.
Here's my code that's currently written in a Suitelet for debugging purposes. Eventually the code will be placed in a server side after submit event.
//POST
var _uname= 'myuser';
var _pwd = 'mypassword';
var myxml = "pretend this is an xml string";
var oburl = 'http://something.com/abccompany/abcompany.asmx';
var postStr= '<?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>'+ '<ImportXML xmlns="http://something.com/abccompany/">' + '<xml>'+ myxml + '</xml>' + '<UserName>' + _uname + '</UserName>'+
'<Password>'+ _pwd + '</Password>'+ '</ImportXML>' +'</soap:Body>' + '</soap:Envelope>';
var header = new Array();
header['Content-Type'] = 'application/soap+xml';
header['Content-Length']= 'length';
header['SOAPAction'] = "http://something.com/abccompany/ImportXML";
var obresponse = nlapiRequestURL(oburl, postStr, header);
var responseXML = obresponse.getBody();//nlapiStringToXML( obresponse.getBody() );
var form = nlapiCreateForm('OB_XML_Result');
var myInlineHtml = form.addField('custpage_notice', 'inlinehtml');
myInlineHtml.setDefaultValue("<html><body><h1><fon t size="3">" + responseXML + "</font></h1></body></html>");
response.writePage(form);
}