This topic contains 0 replies, has 0 voices, and was last updated by Larry B. 9 years, 6 months ago.

  • Author
    Posts
  • #6972

    Larry B.

    EDIT: The problem was with another section of the code. There was nothing wrong with the envelope or the cURL settings and everything is now working.

    I’m trying to add a SalesOrder record using SuiteTalk by sending a SOAP request using PHP and its cURL extension. (We cannot use NetSuite’s PHPToolkit because our web host does not have and cannot install PHP5’s SOAP extension.)

    Here is the seemingly valid envelope being sent with sensitive information replaced:

    Code:



    false
    true 1000
    REMOVED REMOVED REMOVED





    TEST-OrderId true
    billemail@example.com

    TEST-bill-first TEST-bill-last TEST-bill-phone
    TEST-bill-address1
    TEST-bill-address2
    Eugene
    OR
    TEST-bill-zip


    TEST-ship-first TEST-ship-last TEST-ship-phone
    TEST-ship-address1
    TEST-ship-address2
    Eugene
    OR
    97401


    3.02 REMOVED
    2016-01-02T22:29:00+01:00
    false



    2
    2.01
    4.02


    TEST-1: Value-1,TEST-2: Value-2








    This is the ‘Record is an abstract type’ error received after the above envelope is sent:

    Code:

    soapenv:Server.userException
    org.xml.sax.SAXException: {urn:core_2014_2.platform.webservices.netsuite.com}Record is an abstract type and cannot be instantiated

    partners-java003.svale.netledger.com



    I write that the envelope is valid because I have sent the exact same XML via SoapUI 5.1.3 to SuiteTalk with success. When sending the request via SoapUI I receive this response:

    Code:

    REMOVED





    This suggests there is a problem with the way the request is being sent by cURL. Here are the current settings of the cURL object in the PHP script and the headers cURL is sending: ($dom is the DOMDocument of the Envelope request)

    Code:
    curl_setopt($curl, CURLOPT_URL, ‘https://webservices.netsuite.com/services/NetSuitePort_2014_2’);
    curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 20);
    curl_setopt($curl, CURLOPT_TIMEOUT, 5);
    curl_setopt($curl, CURLOPT_POST, true);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $dom->saveXML());
    curl_setopt($curl, CURLOPT_CAINFO, ‘ca/cacert.pem’);

    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_FOLLOWLOCATION, false);
    curl_setopt($curl, CURLOPT_VERBOSE, 1);
    curl_setopt($curl, CURLOPT_COOKIESESSION, true);
    curl_setopt($curl, CURLOPT_FORBID_REUSE, true);
    curl_setopt($curl, CURLOPT_COOKIE, ‘JSESSIONID=;NS_VER=2015.1.0;path=/’);
    curl_setopt($curl, CURLOPT_HTTPHEADER, array(
    ‘SOAPAction: “‘ . $soapAction . ‘”‘,
    ‘Content-Type: text/xml;charset=UTF-8’,
    ‘Connection: Close’,
    ‘Expect:’
    ));

    ======================

    headers from CURLINFO_HEADER_OUT and curl_getinfo:

    [“request_header”]=>
    string(234) “POST /services/NetSuitePort_2014_2 HTTP/1.1
    Host: webservices.netsuite.com
    Accept: */*
    Cookie: JSESSIONID=;NS_VER=2015.1.0;path=/
    SOAPAction: “add”
    Content-Type: text/xml;charset=UTF-8
    Connection: Close
    Content-Length: 3095


    Note that I have been able to successfully add Customer and InventoryItem records to NetSuite by sending these kind of envelopes to SuiteTalk through cURL. It is only when I try to add a SalesOrder record do I get the ‘Record is an abstract type and cannot be instantiated’ fault.

    I haven’t been able to determine what is causing the request be sent incorrectly. Any advice on what is wrong or how to solve this problem is welcome.
    This is a cached copy. Click here to see the original post.

You must be logged in to reply to this topic.