我正在尝试发布此WSDL服务的帖子:
https://elstestserver.endicia.com/LabelService/EwsLabelService.asmx?wsdl
API文档给出了以下示例:(https://www.endicia.com/developer/docs/els.html#validateaddressrequest)
POST /LabelService/EwsLabelService.asmx HTTP/1.1
Host: labelserver.endicia.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "www.envmgr.com/LabelService/ValidateAddress"
<ValidateAddress>
<ValidateAddressRequest>
<RequesterID>String</RequesterID>
<CertifiedIntermediary>
<AccountID>String</AccountID>
<PassPhrase>String</PassPhrase>
</CertifiedIntermediary>
<Address>
<Name>String</Name>
<Company>String</Company>
<Address1>String</Address1>
<City>String</City>
<State>String</State>
</Address>
</ValidateAddressRequest>
</ValidateAddress>
但是我不能弄清楚信封的正确格式。
我尝试过:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ValidateAddress>
<ValidateAddressRequest>
<RequesterID>String</RequesterID>
<CertifiedIntermediary>
<AccountID>String</AccountID>
<PassPhrase>String</PassPhrase>
</CertifiedIntermediary>
<Address>
<Name>String</Name>
<Company>String</Company>
<Address1>String</Address1>
<City>String</City>
<State>String</State>
</Address>
</ValidateAddressRequest>
</ValidateAddress>
</soap:Body>
</soap:Envelope>
但这给了我一个无效的格式错误。
我应该如何确定正确的信封格式?
答案 0 :(得分:0)
您是正确的进一步解决方案:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns="www.envmgr.com/LabelService">
<soap:Body>
<ValidateAddress>
<ValidateAddressRequest>
<RequesterID>String</RequesterID>
<CertifiedIntermediary>
<AccountID>test</AccountID>
<PassPhrase>123</PassPhrase>
</CertifiedIntermediary>
<Address>
<Name>String</Name>
<Company>String</Company>
<Address1>String</Address1>
<City>String</City>
<State>String</State>
</Address>
</ValidateAddressRequest>
</ValidateAddress>
</soap:Body>
</soap:Envelope>
卷曲请求示例
curl --location --request POST 'https://labelserver.endicia.com/LabelService/EwsLabelService.asmx' \
--header 'SOAPAction: www.envmgr.com/LabelService/ValidateAddress' \
--header 'Content-Type: text/xml' \
--data-raw '<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns="www.envmgr.com/LabelService">
<soap:Body>
<ValidateAddress>
<ValidateAddressRequest>
<RequesterID>String</RequesterID>
<CertifiedIntermediary>
<AccountID>test</AccountID>
<PassPhrase>123</PassPhrase>
</CertifiedIntermediary>
<Address>
<Name>String</Name>
<Company>String</Company>
<Address1>String</Address1>
<City>String</City>
<State>String</State>
</Address>
</ValidateAddressRequest>
</ValidateAddress>
</soap:Body>
</soap:Envelope>'
和响应(在本例中为用户ID)
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<ValidateAddressResponse xmlns="www.envmgr.com/LabelService">
<ValidateAddressResponse>
<Status>61501</Status>
<ErrorMessage>Account ID test is invalid. Error encountered (Log ID: 46531)</ErrorMessage>
<AddressMatch>false</AddressMatch>
<CityStateZipOK>false</CityStateZipOK>
<ResidentialDeliveryIndicator>false</ResidentialDeliveryIndicator>
<IsPOBox>false</IsPOBox>
</ValidateAddressResponse>
</ValidateAddressResponse>
</soap:Body>
</soap:Envelope>