如何将NetSuite集成到基于PHP SOAP的系统中

How can I integrate NetSuite to a PHP SOAP Based system?

本文关键字:SOAP PHP 系统 NetSuite 集成      更新时间:2023-09-26

我想问一下,如何使用NetSuite的nlapiRequestURL()调用应用程序的PHP SOAP函数?到目前为止,这就是我所拥有的nlapiRequestURL(),但我想知道我是否可以使用wsdl URL的函数。谢谢

这将非常困难,因为NetSuite不包括SOAP客户端。你可能会使用JS SOAP库,但我不会指望它。看看你的应用程序是否也有REST接口,这会更容易使用。你可以在这里结账类似的问题

另一种方法是将自定义代码放在PHP应用程序中,让它与NetSuite的SOAP接口对话。

您必须构造xml并使用nlapiRequestURL传递它。类似这样的东西:

var postBody = '<?xml version="1.0" encoding="UTF-8" ?><SOAP-ENV:Envelope  xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xmlns:xs="http://www.w3.org/2001/XMLSchema"><SOAP-ENV:Header><sapsess:Session xmlns:sapsess="http://www.sap.com/webas/630/soap/features/session/"><enableSession>true</enableSession></sapsess:Session></SOAP-ENV:Header><SOAP-ENV:Body><ns1:Ztest xmlns:ns1="urn:sap-com:document:sap:soap:functions:mc-style"></ns1:Ztest></SOAP-ENV:Body></SOAP-ENV:Envelope>';
var headers = {"Content-type": "application/xml"};
var url = 'http://sapserver/sap/bc/srt/rfc/sap/ztest/200/ztest/binding';
var aResponse = nlapiRequestURL(url, postBody, headers, 'POST');