[英]WSO2 payload factory appending additional field with JSON request
我正在WSO2 ESB中创建JSON有效负载。 但是最近我注意到到达端点时,它在消息正文的开头和结尾添加了一些额外的字段。 因此,JSON结构正在更改,结果无法生成实际结果。 从正常日志中看不到多余的字段,但是如果启用http连线日志,则会注意到这些字段。 我要粘贴下面的代码以及电汇记录。
<payloadFactory media-type="json">
<format>
{
"ExtReference": "$8",
"MemberSubType":{
"MemberSubTypeId":"20",
"Name":"DD"},
"Region": "",
"PersonalDetails": {
"FirstName": "$9",
"LastName": "sample",
"MiddleName": "",
"DateOfBirth": "",
"GenderType": "",
"SalutationType":"",
"MemberStatus":""
},
"Address": [{
"AddressLine1": "$1",
"AddressLine2": "$2",
"HouseName": "",
"HouseNumber": "",
"Street": "",
"Locality": "",
"City": "$3",
"County": "",
"Zip": "$15",
"CountryId": "NZ",
"PostBox": "",
"PostBoxNumber": ""
}],
"ContactDetails": [{
"Email": "$5",
"Phone": "$10",
"MobilePhone": "$7",
"Fax": "$6",
"ContactDetailsType": ""
}],
"ExtensionData": [{
"PropertyName":"",
"PropertyValue":""
}]
}
</format>
<args>
<arg evaluator="xml"
expression="//cus:addParentCustToJADERequest/cus:parentCustData/cus:addr1/text()"/>
<arg evaluator="xml"
expression="//cus:addParentCustToJADERequest/cus:parentCustData/cus:addr2/text()"/>
<arg evaluator="xml"
expression="//cus:addParentCustToJADERequest/cus:parentCustData/cus:city/text()"/>
<arg evaluator="xml"
expression="//cus:addParentCustToJADERequest/cus:parentCustData/cus:country/text()"/>
<arg evaluator="xml"
expression="//cus:addParentCustToJADERequest/cus:parentCustData/cus:email/text()"/>
<arg evaluator="xml"
expression="//cus:addParentCustToJADERequest/cus:parentCustData/cus:fax/text()"/>
<arg evaluator="xml"
expression="//cus:addParentCustToJADERequest/cus:parentCustData/cus:mobile/text()"/>
<arg evaluator="xml"
expression="//cus:addParentCustToJADERequest/cus:parentCustData/cus:nSInternalID/text()"/>
<arg evaluator="xml"
expression="//cus:addParentCustToJADERequest/cus:parentCustData/cus:name/text()"/>
<arg evaluator="xml"
expression="//cus:addParentCustToJADERequest/cus:parentCustData/cus:phone/text()"/>
<arg evaluator="xml"
expression="//cus:addParentCustToJADERequest/cus:parentCustData/cus:salesRep/text()"/>
<arg evaluator="xml"
expression="//cus:addParentCustToJADERequest/cus:parentCustData/cus:state/text()"/>
<arg evaluator="xml"
expression="//cus:addParentCustToJADERequest/cus:parentCustData/cus:territory/text()"/>
<arg evaluator="xml"
expression="//cus:addParentCustToJADERequest/cus:parentCustData/cus:url/text()"/>
<arg evaluator="xml"
expression="//cus:addParentCustToJADERequest/cus:parentCustData/cus:zip/text()"/>
</args>
</payloadFactory>
<property name="messageType"
value="application/json"
scope="axis2"
type="STRING"/>
<log separator=", ****JSON_Request****">
<property name="toJSON" expression="json-eval($.)"/>
</log>
<call>
<endpoint>
<http method="post" uri-template="http://localhost:8281/scholasticapi/member"/>
<property name="Authorization"
value="78ca6121-763c-41c6-8dfe-d73e761b9989;https://uat.snipp.ie/scholasticapi/member;Fri Jul 24 2015 15:03:02 GMT+0530 (India Standard Time);idiuOEsgiVQU2cJj2p2nawCEHGtyN1cIWzpHP+NlJm4="
scope="transport"/>
<property name="Content-Type" value="application/json" scope="transport"/>
</endpoint>
</call>
当它到达端点时,我记录了启用连接的请求。
[2015-07-30 19:15:23,854] DEBUG - wire << "[\r][\n]"
[2015-07-30 19:15:23,855] DEBUG - wire << "44d[\r][\n]"
[2015-07-30 19:15:23,855] DEBUG - wire << "{[\n]"
[2015-07-30 19:15:23,856] DEBUG - wire << " "ExtReference": "4545",[\n]"
[2015-07-30 19:15:23,856] DEBUG - wire << " "MemberSubType":{[\n]"
[2015-07-30 19:15:23,856] DEBUG - wire << "[0x9][0x9][0x9]"MemberSubTypeId":"20",[\n]"
[2015-07-30 19:15:23,861] DEBUG - wire << "[0x9][0x9][0x9]"Name":"DD"},[\n]"
[2015-07-30 19:15:23,861] DEBUG - wire << " "Region": "", [\n]"
[2015-07-30 19:15:23,862] DEBUG - wire << " "PersonalDetails": {[\n]"
[2015-07-30 19:15:23,862] DEBUG - wire << " "FirstName": "arisan",[\n]"
[2015-07-30 19:15:23,862] DEBUG - wire << " "LastName": "sample",[\n]"
[2015-07-30 19:15:23,863] DEBUG - wire << " "MiddleName": "",[\n]"
[2015-07-30 19:15:23,863] DEBUG - wire << " "DateOfBirth": "",[\n]"
[2015-07-30 19:15:23,863] DEBUG - wire << " "GenderType": "",[\n]"
[2015-07-30 19:15:23,863] DEBUG - wire << " "SalutationType":"",[\n]"
[2015-07-30 19:15:23,864] DEBUG - wire << " "MemberStatus":""[\n]"
[2015-07-30 19:15:23,864] DEBUG - wire << " },[\n]"
[2015-07-30 19:15:23,864] DEBUG - wire << " "Address": [{[\n]"
[2015-07-30 19:15:23,865] DEBUG - wire << " "AddressLine1": "vfhd",[\n]"
[2015-07-30 19:15:23,865] DEBUG - wire << " "AddressLine2": "jdfvbgkjfds",[\n]"
[2015-07-30 19:15:23,865] DEBUG - wire << " "HouseName": "",[\n]"
[2015-07-30 19:15:23,865] DEBUG - wire << " "HouseNumber": "",[\n]"
[2015-07-30 19:15:23,866] DEBUG - wire << " "Street": "",[\n]"
[2015-07-30 19:15:23,866] DEBUG - wire << " "Locality": "",[\n]"
[2015-07-30 19:15:23,866] DEBUG - wire << " "City": "kolkata",[\n]"
[2015-07-30 19:15:23,866] DEBUG - wire << " "County": "",[\n]"
[2015-07-30 19:15:23,867] DEBUG - wire << " "Zip": "43543",[\n]"
[2015-07-30 19:15:23,867] DEBUG - wire << " "CountryId": "NZ",[\n]"
[2015-07-30 19:15:23,867] DEBUG - wire << " "PostBox": "",[\n]"
[2015-07-30 19:15:23,867] DEBUG - wire << " "PostBoxNumber": ""[\n]"
[2015-07-30 19:15:23,868] DEBUG - wire << " }],[\n]"
[2015-07-30 19:15:23,868] DEBUG - wire << " "ContactDetails": [{[\n]"
[2015-07-30 19:15:23,868] DEBUG - wire << " "Email": "sdjk@hs.com",[\n]"
[2015-07-30 19:15:23,868] DEBUG - wire << " "Phone": "378654839674",[\n]"
[2015-07-30 19:15:23,869] DEBUG - wire << " "MobilePhone": "87425343287",[\n]"
[2015-07-30 19:15:23,869] DEBUG - wire << " "Fax": "345435",[\n]"
[2015-07-30 19:15:23,869] DEBUG - wire << " "ContactDetailsType": ""[\n]"
[2015-07-30 19:15:23,869] DEBUG - wire << " }],[\n]"
[2015-07-30 19:15:23,870] DEBUG - wire << " "ExtensionData": [{[\n]"
[2015-07-30 19:15:23,870] DEBUG - wire << "[0x9][0x9][0x9]"PropertyName":"", [\n]"
[2015-07-30 19:15:23,870] DEBUG - wire << "[0x9][0x9][0x9]"PropertyValue":""[\n]"
[2015-07-30 19:15:23,870] DEBUG - wire << "[0x9][0x9][0x9]}][\n]"
[2015-07-30 19:15:23,871] DEBUG - wire << "}[\r][\n]"
[2015-07-30 19:15:23,871] DEBUG - wire << "0[\r][\n]"
[2015-07-30 19:15:23,871] DEBUG - wire << "[\r][\n]"
在日志的第二行中看到显示了一个值44d ,在第二行中显示了一个附加值零 ,该值在有效负载中的任何地方都没有提供过。 我已经从系统所有者那里确认,对于这两个垃圾值,仅请求失败。 请提出一种摆脱这两个领域的束缚的方法。 提前致谢。
最后的零与“有效负载”返回给客户端的方式有关,即“分块”传输。
(请参阅: https : //en.wikipedia.org/wiki/Chunked_transfer_encoding )
简而言之,44d只是该“块”中一部分的字节数。 最后的“ 0”表示没有更多的块。
在将请求发送到后端服务器之前,可以使用: <property name="DISABLE_CHUNKING" value="true" scope="axis2"/>
。 这样会很好...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.