xml - 肥皂信封格式无效
问题描述
我正在尝试向此 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>
但这给了我一个无效的格式错误。
我应该如何确定正确的信封格式?
解决方案
你是对的,进一步的解决方案:
<?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>
推荐阅读
- gatsby - Algolia 未能在 netlify deploy 上建立索引
- html - 如何让 flex-grow 忽略填充?
- java - java spring 的 TLS
- excel - 基于多个单元格交集的文本框值
- docker - 与 docker 1.7.0 一起使用的 docker-compose 的确切版本是什么?
- dialogflow-es - 在对话流中从一个意图重定向到另一个意图
- android - 广播接收器在 Android 中不起作用
- python - 用数据集中正确的国家名称替换错误的国家名称
- reactjs - 带有 cookie 的 HOC 私有路由上的 nextjs 9.4 错误
- reactjs - Moment js,React:月份渲染问题