Jump to content

hinesj87

Registered Users - Approved
  • Posts

    9
  • Joined

Posts posted by hinesj87

  1. My original intent was to use native PHP functionality to submit jobs to the SOAP server. Due to (my IIS) server configuration and a general lack of ambition to troubleshoot the issues I have encountered, I have decided to use Curl.

     

    Here is the code:

    <?php
    
    error_reporting(E_ALL);
    ini_set('display_errors', 1);
    
    $endpoint_url = "https://services.printable.com/trans/1.0/PackingSlip.asmx?wsdl";
    
    $soap_action_url = "http://www.printable.com/WebService/PackingSlip/CreatePackingSlipByLineItem";
    
    $xml = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:pac="http://www.printable.com/WebService/PackingSlip">
      <soapenv:Header/>
      <soapenv:Body>
         <pac:CreatePackingSlipByLineItem>
            <pac:pRequest>
               <PartnerCredentials>
                  <Token>TOKEN_STRING</Token>
               </PartnerCredentials>
               <PackingSlipNode>
                  <PackingSlipNumber>PACKINGSLIPNUMBER_STRING</PackingSlipNumber>
                  <ShipDate>SHIPDATE_DATE</ShipDate>
                  <CarrierName>CARRIERNAME_STRING</CarrierName>
                  <TrackingNumber>TRACKINGNUMBER_STRING</TrackingNumber>
                  <ShipCost>SHIPCOST_FLOAT</ShipCost>
                  <SkipAdjustInventory>BOOL</SkipAdjustInventory>
                  <ShipToAddress>
                     <Attention>ATTENTION_STRING</Attention>
                     <Name>NAME_STRING</Name>
                     <Address1>ADDR1_STRING</Address1>
                     <Address2>ADDR2_STRING</Address2>
                     <Address3>ADDR3_STRING</Address3>
                     <Address4>ADDR4_STRING</Address4>
                     <City>CITY_STRING</City>
                     <State>STATE_STRING</State>
                     <PostalCode>ZIP_STRING</PostalCode>
                     <Country>COUNTRY_STRING</Country>
                  </ShipToAddress>
               </PackingSlipNode>
               <LineItems>
                  <LineItem>
                     <ID type="Printable">LINE_ITEM_ID_STRING</ID>
                     <Quantity>QTY_INT</Quantity>
                  </LineItem>
               </LineItems>
            </pac:pRequest>
         </pac:CreatePackingSlipByLineItem>
      </soapenv:Body>
    </soapenv:Envelope>';
    
    $send_payload_response = send_payload($endpoint_url, $soap_action_url, $xml);
    
    var_dump($send_payload_response);
    
    exit;
    
    /********************************************
    * Sends an XML payload to the SOAP server of your choice
    *
    * @param string $endpoint_url
    * @param string $soap_action_url
    * @param string $xml
    * @param array $headers
    */
    function send_payload($endpoint_url, $soap_action_url, $xml, $headers = array()) {
    
       $default_headers = array(
           'Content-Type: text/xml; charset="utf-8"', 
           'Content-Length: ' . strlen($xml),
           'SOAPAction: "' . $soap_action_url . '"'
       );
    
       if(count($headers) == 0)
           $headers = $default_headers;
    
       if( ! function_exists('curl_version'))
           die("cURL is not installed. Please relay this error to your friendly neighborhood webmaster.");
    
       $c = curl_init(); 
       curl_setopt($c, CURLOPT_SSL_VERIFYPEER, FALSE);
       curl_setopt($c, CURLOPT_URL, $endpoint_url); 
       curl_setopt($c, CURLOPT_RETURNTRANSFER, TRUE); 
       curl_setopt($c, CURLOPT_TIMEOUT, 60); 
       curl_setopt($c, CURLOPT_HTTPHEADER, $headers);
       curl_setopt($c, CURLOPT_HEADER, 1);
       curl_setopt($c, CURLINFO_HEADER_OUT, TRUE);
       curl_setopt($c, CURLOPT_POST, TRUE); 
       curl_setopt($c, CURLOPT_POSTFIELDS, $xml);
    
       $response = curl_exec($c);
    
       // debug
       // echo "<pre>" . htmlentities($xml) . "<hr>" . var_dump($response); exit;
    
       return $response;
    }

  2. I'm trying to create a packing slip in PHP. What is the correct method of passing in the PartnerCredentials.Token?

     

    <?php
    $xml = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:pac="http://www.printable.com/WebService/PackingSlip">
      <soapenv:Header/>
      <soapenv:Body>
         <pac:CreatePackingSlipByLineItem>
            <pac:pRequest>
               <PartnerCredentials>
                  <Token>TOKEN_STRING</Token>
               </PartnerCredentials>
               <PackingSlipNode>
                  <PackingSlipNumber>999999</PackingSlipNumber>
                  <ShipDate>2017-01-19</ShipDate>
                  <CarrierName>UPS</CarrierName>
                  <TrackingNumber>TRACKING_NUMBER</TrackingNumber>
                  <ShipCost>9.99</ShipCost>
              <SkipAdjustInventory></SkipAdjustInventory>
                  <ShipToAddress>
                     <Attention>Attn</Attention>
                     <Name>Name</Name>
                     <Address1>123 Fake St.</Address1>
                     <Address2></Address2>
                     <Address3></Address3>
                     <Address4></Address4>
                     <City>City</City>
                     <State>ST</State>
                     <PostalCode>99999</PostalCode>
                     <Country>US</Country>
                  </ShipToAddress>
               </PackingSlipNode>
               <LineItems>
                  <LineItem>
                     <ID type="Printable">LINE_ITEM_ID</ID>
                     <Quantity>1000</Quantity>
                  </LineItem>
               </LineItems>
            </pac:pRequest>
         </pac:CreatePackingSlipByLineItem>
      </soapenv:Body>
    </soapenv:Envelope>';
    
    $soap = new SoapClient("http://services.printable.com/trans/1.0/PackingSlip.asmx?wsdl", array('trace' => 1, 'cache_wsdl' => WSDL_CACHE_NONE));
    
    $parameters = array(
       "pRequest" => $xml
    );
    
    $soap->CreatePackingSlipbyLineItem($parameters);
    
    header('Content-type: text/xml');
    echo $soap->__getLastResponse(); exit;
    
    

    Here is the response:

     

    <soap:Envelope>
       <soap:Body>
           <CreatePackingSlipByLineItemResponse>
               <CreatePackingSlipByLineItemResult>
                   <OrderId/>
                   <Status Action="PACKING_SLIP" Status="ProcessFailure" Code="2" Message="Service Failure - Printable.WebServices.BusinessLogic - PartnerCredentials.Token element missing."/>
                   <LineItemResponses/>
                   <Actions/>
                   <LineItemID/>
               </CreatePackingSlipByLineItemResult>
           </CreatePackingSlipByLineItemResponse>
       </soap:Body>
    </soap:Envelope>

  3. Result expected:

     

    • The text output to be rendered as "Avenir Next Demi Bold"

    Actual result:

     

    • The text output is rendered as "Avenir Next Demi Bold Italic" (after composing and opening the output file in Adobe Illustrator)

     

    Relevant code from the rule:

    return '<f name="Avenir Next Demi Bold">' + Field("Phone4Header") + ' ' + '</f>';

    Information about the rule:

     

    • The output of the rule is specified to be treated as tagged text

    The font shows in my font.ini as:

     

    • Avenir Next Demi Bold

    There is no mention in font.err. I have also tried setting the text frame to use Avenir, and click the bold icon but that doesn't work either.

     

    Edit: It's not a PostScript font, so maybe that's the issue.

  4. I have an item in the warehouse that comes in different shapes and/or sizes. The static product type does not work because of the varying sizes, so Static w/ Attributes seems like the way to go. The only problem is that I cannot find a way to keep track of the inventory like I can with a true static item.

     

    It seems like I can't do this because I don't have hard-coded SKUs to link an inventory level to.

     

    Any help or explanation would be greatly appreciated.

     

    Thanks!

×
×
  • Create New...