Solved

cxml request using php curl

Posted on 2014-01-07
9
947 Views
Last Modified: 2014-02-20
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
0
Comment
Question by:bradley525
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 39762098
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?
0
 

Author Comment

by:bradley525
ID: 39762140
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?
0
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 39762253
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

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:bradley525
ID: 39774766
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

0
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 39774848
This appears to have an error in line 31.  Any chance we can see the documentation that describes the information you need to send?
0
 

Author Comment

by:bradley525
ID: 39774861
They did not provide any documentation..Just example xml..What is the error? is is  the

"xml:" ?
0
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 39774867
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.
0
 

Accepted Solution

by:
bradley525 earned 0 total points
ID: 39805324
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.
0
 

Author Closing Comment

by:bradley525
ID: 39872873
The cXML request is unique to the customers system. They had to provide unique cridentials and everything worked..
0

Featured Post

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question