2012-05-17 2 views
0


"getShipmentSimpleQuote"webservice를 "Worldwide Express Freight Quote Web Service"에서 호출하는 방법은 무엇입니까? 내가 불러들이려고 /이 웹 서비스를 소비하지만 난 말하는 오류를 얻고 있어요 "잘못된 인증 정보는"라도 좋습니다는 WSDL 파일 데이터 -

WWEXFreightQuoteService.wsdlColdfusion WWW의 webservice getShipmentSimpleQuote 인증 방법은 무엇입니까?

<?xml version="1.0" encoding="UTF-8"?> 
<wsdl:definitions targetNamespace="http://www.wwexship.com" xmlns:impl="http://www.wwexship.com" xmlns:intf="http://www.wwexship.com" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"> 
<!--WSDL created by Apache Axis version: 1.4 
Built on Apr 22, 2006 (06:55:48 PDT)--> 
<wsdl:types> 
    <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.wwexship.com" elementFormDefault="qualified"> 
    <complexType name="AuthenticationToken"> 
    <sequence> 
    <element name="loginId" nillable="true" type="xsd:string"/> 
    <element name="password" nillable="true" type="xsd:string"/> 
    <element name="licenseKey" nillable="true" type="xsd:string"/> 
    <element name="accountNumber" nillable="true" type="xsd:string"/> 
    </sequence> 
    </complexType> 
    <element name="AuthenticationToken" type="impl:AuthenticationToken" maxOccurs="1"/> 
    <complexType name="QuoteLineItem"> 
    <sequence> 
    <element name="nmfcClass" nillable="true" type="xsd:string"/> 
    <element name="weight" nillable="true" type="xsd:string"/> 
    </sequence> 
    </complexType> 
    <complexType name="ArrayOfQuoteLineItem"> 
    <sequence> 
    <element name="lineItem" nillable="true" type="impl:QuoteLineItem" maxOccurs="unbounded"/> 
    </sequence> 
    </complexType> 
    <complexType name="FreightShipmentQuoteRequest"> 
    <sequence> 
    <element name="senderCity" nillable="true" type="xsd:string"/> 
    <element name="senderState" nillable="true" type="xsd:string"/> 
    <element name="senderZip" nillable="true" type="xsd:string"/> 
    <element name="receiverCity" nillable="true" type="xsd:string"/> 
    <element name="receiverState" nillable="true" type="xsd:string"/> 
    <element name="receiverZip" nillable="true" type="xsd:string"/> 
    <element name="lineItems" nillable="true" type="impl:ArrayOfQuoteLineItem"/> 
    <element name="hazmatShipment" nillable="true" type="xsd:string"/> 
    <element name="insidePickup" nillable="true" type="xsd:string"/> 
    <element name="liftgatePickup" nillable="true" type="xsd:string"/> 
    <element name="residentialPickup" nillable="true" type="xsd:string"/> 
    <element name="tradeshowPickup" nillable="true" type="xsd:string"/> 
    <element name="constructionSitePickup" nillable="true" type="xsd:string"/> 
    <element name="insideDelivery" nillable="true" type="xsd:string"/> 
    <element name="liftgateDelivery" nillable="true" type="xsd:string"/> 
    <element name="residentialDelivery" nillable="true" type="xsd:string"/> 
    <element name="tradeshowDelivery" nillable="true" type="xsd:string"/> 
    <element name="constructionSiteDelivery" nillable="true" type="xsd:string"/> 
    <element name="notifyBeforeDelivery" nillable="true" type="xsd:string"/> 
    </sequence> 
    </complexType> 
    <element name="freightShipmentQuoteRequest" type="impl:FreightShipmentQuoteRequest"/> 
    <complexType name="ErrorDescription"> 
    <sequence> 
    <element name="errorDescription" nillable="true" type="xsd:string" maxOccurs="unbounded"/> 
    </sequence> 
    </complexType> 
    <complexType name="CarrierQuoteResult"> 
    <sequence> 
    <element name="carrierName" nillable="true" type="xsd:string"/> 
    <element name="carrierSCAC" nillable="true" type="xsd:string"/> 
    <element name="totalPrice" nillable="true" type="xsd:string"/> 
    <element name="transitDays" nillable="true" type="xsd:string"/> 
    <element name="interline" nillable="true" type="xsd:string"/> 
    <element name="guaranteedService" nillable="true" type="xsd:string"/> 
    <element name="highCostDeliveryShipment" nillable="true" type="xsd:string"/> 
    <element name="nmfcRequired" nillable="true" type="xsd:string"/> 
    </sequence> 
    </complexType> 
    <complexType name="ArrayOfCarrierQuoteResult"> 
    <sequence> 
    <element name="carrierQuoteResult" nillable="true" type="impl:CarrierQuoteResult" maxOccurs="unbounded"/> 
    </sequence> 
    </complexType> 
    <complexType name="FreightShipmentQuoteResponse"> 
    <sequence> 
    <element name="responseStatusCode" nillable="true" type="xsd:string"/> 
    <element name="responseStatusDescription" nillable="true" type="xsd:string"/> 
    <element name="errorDescriptions" nillable="true" type="impl:ErrorDescription"/> 
    <element name="quoteResults" nillable="true" type="impl:ArrayOfCarrierQuoteResult"/> 
    </sequence> 
    </complexType> 
    <element name="freightShipmentQuoteResponse" type="impl:FreightShipmentQuoteResponse"/> 
    </schema> 
</wsdl:types> 
<wsdl:message name="getShipmentSimpleQuoteResponse"> 
    <wsdl:part name="freightShipmentQuoteResponse" element="impl:freightShipmentQuoteResponse"/> 
</wsdl:message> 
<wsdl:message name="FreightShipmentQuoteRequestHeaders"> 
    <wsdl:part name="authenticationToken" element="impl:AuthenticationToken"/> 
</wsdl:message> 
<wsdl:message name="getShipmentSimpleQuoteRequest"> 
    <wsdl:part name="freightShipmentQuoteRequest" element="impl:freightShipmentQuoteRequest"/> 
</wsdl:message> 
<wsdl:portType name="FreightShipmentQuote"> 
    <wsdl:operation name="getShipmentSimpleQuote" parameterOrder="freightShipmentQuoteRequest"> 
    <wsdl:input name="getShipmentSimpleQuoteRequest" message="impl:getShipmentSimpleQuoteRequest"/> 
    <wsdl:output name="getShipmentSimpleQuoteResponse" message="impl:getShipmentSimpleQuoteResponse"/> 
    </wsdl:operation> 
</wsdl:portType> 
<wsdl:binding name="FreightShipmentQuoteSoapBinding" type="impl:FreightShipmentQuote"> 
    <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> 
    <wsdl:operation name="getShipmentSimpleQuote"> 
    <wsdlsoap:operation soapAction=""/> 
    <wsdl:input name="getShipmentSimpleQuoteRequest"> 
    <wsdlsoap:body use="literal"/> 
    <wsdlsoap:header message="impl:FreightShipmentQuoteRequestHeaders" part="authenticationToken" use="literal"> 
    </wsdlsoap:header> 
    </wsdl:input> 
    <wsdl:output name="getShipmentSimpleQuoteResponse"> 
    <wsdlsoap:body use="literal"/> 
    </wsdl:output> 
    </wsdl:operation> 
</wsdl:binding> 
<wsdl:service name="FreightShipmentQuoteService"> 
    <wsdl:port name="FreightShipmentQuote" binding="impl:FreightShipmentQuoteSoapBinding"> 
    <wsdlsoap:address location="http://www.wwexship.com/webServices/services/FreightShipmentQuote"/> 
    </wsdl:port> 
</wsdl:service> 
</wsdl:definitions> 


내 웹 서비스를 사용/호출하는 coldfusion 코드는
consume.cfm

내 로그인 자격 증명이 이용하는이 웹 서비스를 인증 할 수 없습니다입니다



(1)은 loginid = copssship
(2) 암호 = 암호
(3) licenseKey = hhrWQ7RMJEDKJMh4
(4)이 accountNumber = W922601302

이 웹 서비스를 인증하는 방법을 제안하십시오.

+0

API 제공 업체의 설명서가 있습니까? 내 추측으로는 HTTP 기반을 사용하고 있다는 것입니다. barnyr

+0

아래 답변이 당신을 위해 일 했나요? – barnyr

답변

0

나는 대답을 가지고있을 것 같아. 인증 정보는 헤더로 지정됩니다. ColdFusion은 이와 같은 상황에 대해 AddSoapRequestHeader() 메소드를 제공합니다. 값을 텍스트 또는 XML로 표시하려고합니다. 아래의 코드가 실행되어 성공 코드를 얻습니다. 헤더를 추가하는 것뿐만 아니라 NMFC 코드를 300으로 변경하고 가중치를 2로 변경했습니다.이 서비스는 초기 값에 대해 불만을 나타 냈습니다.

shipService = CreateObject("webservice","http://www.wwexship.com/webServices/services/FreightShipmentQuote?wsdl"); 


doc = XmlNew(); 
doc.xmlRoot = XmlElemNew(doc, "http://www.wwexship.com", "AuthenticationToken"); 


loginId = XmlElemNew(doc, "http://www.wwexship.com", "loginId"); 
loginId.XmlText = "copssship"; 
loginId.XmlAttributes["xsi:type"] = "xsd:string"; 
doc.xmlRoot.XmlChildren[1] = loginId; 


password = XmlElemNew(doc, "http://www.wwexship.com", "password"); 
password.XmlText = "password"; 
password.XmlAttributes["xsi:type"] = "xsd:string"; 
doc.xmlRoot.XmlChildren[2] = password; 


licenseKey = XmlElemNew(doc, "http://www.wwexship.com", "licenseKey"); 
licenseKey.XmlText = "hhrWQ7RMJEDKJMh4"; 
licenseKey.XmlAttributes["xsi:type"] = "xsd:string"; 
doc.xmlRoot.XmlChildren[3] = licenseKey; 

accountNumber = XmlElemNew(doc, "http://www.wwexship.com", "accountNumber"); 
accountNumber.XmlText = "W922601302"; 
accountNumber.XmlAttributes["xsi:type"] = "xsd:string"; 
doc.xmlRoot.XmlChildren[4] = accountNumber; 

AddSOAPRequestHeader(shipService,"http://www.wwexship.com","authenticationToken",doc); 

response=shipService.getShipmentSimpleQuote(st); 
2

PHP 웹 서비스 http://www.wwexship.com을 구현했습니다. 잘 작동합니다.

<?php 

$items = array(); 
$items[] = array('nmfcClass' => '50','weight' => '10'); 
$items[] = array('nmfcClass' => '50','weight' => '20'); 
$auth = Array('loginId' => "your Id", 'password' => "Your Pass",'licenseKey'=>'Your key','accountNumber'=>'Your account no,') ; 
$client = new SoapClient('wsdl.xml',array('trace' =>1)); 
$header = new SoapHeader('http://www.wwexship.com','AuthenticationToken',$auth,false); 
$client->__setSoapHeaders(array($header)); 
$result = $client->getShipmentSimpleQuote(array('senderCity' => 'Freeport','senderState'=>'NY','senderZip'=>'11520','receiverCity'=>'Staten Island','receiverState'=>'NY', 'receiverZip'=>'10314','lineItems'=>$items)); 
echo '<pre>'; 
print_r($result); 
+0

코드를 사용해 보았지만 인증 오류가 발생했습니다. 참고 : WWEST에 제공된 테스트 환경 키를 사용하고 있습니다. 예를 들어, http://developer.wex.welcome.com/webServices/services/SpeedFreightShipment dev 문서에 언급 된 엔드 포인트를 시도했습니다. 가능한 문제 일 수 있습니까? – Moax6629

+0

@ Moax6629 죄송합니다. 나는 4 년 전에 그것을 연구했기 때문에 나는 그것에 관련된 것을 기억할 수 없다. –

+0

아, 이해합니다. 힘내 친구 야 :) – Moax6629

관련 문제