cxml request using php curl

I am working with an ERP system that wants to use a cxml punchout.

I am using a CURL script but I am not recieving any response.

The code I am using is:

$data = 
array( "Credential" => array("Identity"=>"xxxxxx"),array("Secret"=>"xxxxxx")); 
                                                               
$data_string = json_encode($data);                                                                                   
$ch = curl_init('https://xxxxxxxx/12456');

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");                                                                     
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);                                                                  
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);                                                                      
curl_setopt($ch, CURLOPT_HTTPHEADER, array(     
	'domain: DUNS',                                                                 
	'Content-Type: text/xml',
	'Content-Type: application/xml ',                                                                          
    'Content-Length: ' . strlen($data_string))                                                                       
);   
                                                                                                               

$result = curl_exec($ch);

print_r($result);

Open in new window


I am receiving the following error:


Error Processing Request. ErrorMessage: 'Enveloping Error' TrackID: '371557229' Date: '2014.01.07 14:11:12 UTC'


Not really sure where to start or how to build the request...

Thanks
bradley525Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ray PaseurCommented:
This does not look like an error.  It looks like a valid response from the ERP resource.  Can you show us a link to the examples of how to use the ERP system?
bradley525Author Commented:
Hi Ray,

Right now I am just trying to get a response. This is actually just a file and not part of a system.  Above is everything I have..Are you looking for more documentation?
Ray PaseurCommented:
You are getting a response.  Response is a term of art in API processing.  But that said, it's probably not the response you want.  The cURL part is working correctly.  The script has connected successfully to the ERP resource, and the resource said, "Error Processing Request..."  

That's why we need to see the documentation that tells how to present the credentials.  It may be very simple, but until we know what the ERP system expects, we would just be guessing.

Here is one guess:

$data = 
array( "Credential" => array("Identity"=>"xxxxxx","Secret"=>"xxxxxx")); 

Open in new window

Amazon Web Services

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

bradley525Author Commented:
Sorry it took me so long to respond I wanted to get some example documentation. Here is the xml that needs to be sent to get the vaild response. I am not sure how to put this into a CURL format..Any help would be greatly appreciated.

Thanks

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE cXML SYSTEM "http://xml.cXML.org/schemas/cXML/1.2.011/cXML.dtd">
<cXML timestamp="2013-11-14T12:33:56 -05:00" payloadID="1384450436804.960375321871699717@" version="1.2.011">
   <Header>
      <From>
         <Credential domain="NetworkID">
            <Identity>Company Name</Identity>
         </Credential>
      </From>
      <To>
         <Credential domain="DUNS">
            <Identity>SigmaAldrich</Identity>
         </Credential>
      </To>
      <Sender>
         <Credential domain="NetworkID">
            <Identity>Sender ID</Identity>
            <SharedSecret>SIG07ALD</SharedSecret>
         </Credential>
         <UserAgent>BioProcure</UserAgent>
      </Sender>
   </Header>
   <Request deploymentMode="production">
      <OrderRequest>
         <OrderRequestHeader orderDate="2013-11-14T12:33:56-0500" orderID="PO Value" type="new">
            <Total>
               <Money currency="USD">241.50</Money>
            </Total>
            <ShipTo>
               <Address isoCountryCode="US" addressID="Ship to ID">
                  <Name xml:lang="en-US">Company Name/Name>
                  <PostalAddress name="default">
                     <DeliverTo>Attn Line</DeliverTo>
                     <DeliverTo>Bldg and Room </DeliverTo>
                     <Street>Street Address</Street>
                     <City>City</City>
                     <State>MO</State>
                     <PostalCode>Zip Code</PostalCode>
                     <Country isoCountryCode="US">US</Country>
                  </PostalAddress>
                  <Email name="default">a@b.com</Email>
                  <Phone name="work">
                     <TelephoneNumber>
                        <CountryCode isoCountryCode="US">1</CountryCode>
                        <AreaOrCityCode>555</AreaOrCityCode>
                        <Number>5555555</Number>
                     </TelephoneNumber>
                  </Phone>
                  <Fax name="">
                     <TelephoneNumber>
                        <CountryCode isoCountryCode="" />
                        <AreaOrCityCode />
                        <Number />
                     </TelephoneNumber>
                  </Fax>
               </Address>
            </ShipTo>
            <BillTo>
               <Address isoCountryCode="" addressID="ACCOUNTS PAYABLE">
                  <Name xml:lang="en-US">Company Name</Name>
                  <PostalAddress name="default">
                     <DeliverTo>Accounts Payable</DeliverTo>
                     <Street>Street</Street>
                     <City>City</City>
                     <State>MO</State>
                     <PostalCode>Zip Code</PostalCode>
                     <Country isoCountryCode="US">US</Country>
                  </PostalAddress>
                  <Email name="default">a@b.com</Email>
                  <Phone name="work">
                     <TelephoneNumber>
                        <CountryCode isoCountryCode="US">1</CountryCode>
                        <AreaOrCityCode>555</AreaOrCityCode>
                        <Number>5555555</Number>
                     </TelephoneNumber>
                  </Phone>
                  <Fax name="">
                     <TelephoneNumber>
                        <CountryCode isoCountryCode="" />
                        <AreaOrCityCode />
                        <Number />
                     </TelephoneNumber>
                  </Fax>
               </Address>
            </BillTo>
            <Contact role="user">
               <Name xml:lang="en-US">enduser name</Name>
               <PostalAddress name="">
                  <Street />
                  <City />
                  <Country isoCountryCode="" />
               </PostalAddress>
               <Email name="">a@b.com</Email>
               <Phone name="">
                  <TelephoneNumber>
                     <CountryCode isoCountryCode="" />
                     <AreaOrCityCode />
                     <Number />
                  </TelephoneNumber>
               </Phone>
            </Contact>
<Shipping>
               <Money currency=""/>
               <Description xml:lang="en-US">FEDEX STANDARD OVERNIGHT - 3:00pm NEXT BUSINESS DAY</Description>
            </Shipping>
            <Comments />
         </OrderRequestHeader>
         <ItemOut quantity="1" lineNumber="1">
            <ItemID>
               <SupplierPartID>D1523-10MG</SupplierPartID>
               <SupplierPartAuxiliaryID>CartId`78086342</SupplierPartAuxiliaryID>
            </ItemID>
            <ItemDetail>
               <UnitPrice>
                  <Money currency="USD">241.50</Money>
               </UnitPrice>
               <Description xml:lang="en-US">N,N'-DIACETYLCHITOBIOSE, N,N'-DIACETYLCHITOBIOSE</Description>
               <UnitOfMeasure>EA</UnitOfMeasure>
               <Classification domain="UNSPSC">12352201</Classification>
               <ManufacturerPartID />
               <ManufacturerName />
            </ItemDetail>
         </ItemOut>
      </OrderRequest>
   </Request>
</cXML>

Open in new window

Ray PaseurCommented:
This appears to have an error in line 31.  Any chance we can see the documentation that describes the information you need to send?
bradley525Author Commented:
They did not provide any documentation..Just example xml..What is the error? is is  the

"xml:" ?
Ray PaseurCommented:
Line 31 says this:
<Name xml:lang="en-US">Company Name/Name>

I believe that it should say this:
<Name xml:lang="en-US">Company Name</Name>

In the original question we were looking at JSON-encoded data.  This was put into the CURLOPT_POSTFIELDS.  Maybe this XML string is supposed to go there?  I don't know and could not guess unless the provider is able to give us some documentation that says what it expects to receive.
bradley525Author Commented:
I spoke with the company who provided the CXML helped us to get this to work. She had to provide different credentials and and test url. Unfortunately there was nothing I could have done with this code.

Thank you all for the help anyways.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bradley525Author Commented:
The cXML request is unique to the customers system. They had to provide unique cridentials and everything worked..
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
XML

From novice to tech pro — start learning today.