Solved

cxml request using php curl

Posted on 2014-01-07
9
805 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
  • 5
  • 4
9 Comments
 
LVL 108

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 108

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
 

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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 108

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 108

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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

707 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now