Request payload getting truncated when creating a SOAP Pass-through proxy

Not applicable

I am trying to create an API proxy for a backend SOAP Service. I have created a pass-through proxy. The issue is that the request payload is truncated when sent to target server because of which I am getting the UnexpectedEOFAtTarget exception from the backend.

I tried to enable request streaming. It did not help. When I see the curl request sent to the target server, it does not show the full xml payload.

I am able to see the full payload in the trace ui using the assign-message policy. But the same is not being passed to the target.

Any help or advice on how to resolve this is much appreciated!!

Original SOAP Request -

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><br>  <soap:Header><br>   <br>  <Headers xmlns="urn:Ariba:Buyer:vrealm_2067"><br>  <variant>vrealm_2067</variant><br>  <partition>prealm_2068</partition><br>  </Headers><br>  </soap:Header><br>  <soap:Body wsu:Id="id-631385321" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"><br>  <PurchaseOrderExportRequest partition="prealm_2067" variant="vrealm_2067" xmlns="urn:Ariba:Buyer:vrealm_2067"><br>  <ERPOrder_PurchOrdHeaderDetails_Item><br>  <item><br>  <CompanyCode><br>  <UniqueName>1000</UniqueName><br>  </CompanyCode><br>  <CreationDateString>20170227</CreationDateString><br>  <Currency><br>  <UniqueName>USD</UniqueName><br>  </Currency><br>  <OrderMethodCategory>ERPCC</OrderMethodCategory><br>  <OriginatingSystem/><br>  <OriginatingSystemReferenceID/><br>  <PurchaseGroup><br>  <UniqueName>ARB</UniqueName><br>  </PurchaseGroup><br>  <PurchaseOrg><br>  <UniqueName>1000</UniqueName><br>  </PurchaseOrg><br>  <Supplier><br>  <UniqueName>0000300001</UniqueName><br>  </Supplier><br>  <UniqueName>EP182</UniqueName><br>  </item><br>  </ERPOrder_PurchOrdHeaderDetails_Item><br>  <ERPOrder_PurchOrdAcctDetails_Item><br>  <item><br>  <LineItems><br>  <item><br>  <Accountings><br>  <SplitAccountings><br>  <item><br>  <Amount><br>  <Amount>1000.00000</Amount><br>  </Amount><br>  <CostCenter><br>  <UniqueName>1000210016</UniqueName><br>  </CostCenter><br>  <GeneralLedger><br>  <UniqueName>0000110000</UniqueName><br>  </GeneralLedger><br>  <NumberInCollection>1</NumberInCollection><br>  <POLineNumber>00001</POLineNumber><br>  <Percentage>100.00000</Percentage><br>  <Quantity>1.00000</Quantity><br>  </item><br>  </SplitAccountings><br>  </Accountings><br>  <ReceivingType>7</ReceivingType><br>  </item><br>  </LineItems><br>  <UniqueName>EP182</UniqueName><br>  </item><br>  </ERPOrder_PurchOrdAcctDetails_Item><br>  <ERPOrder_PurchOrdLineDetails_Item><br>  <item><br>  <LineItems><br>  <item><br>  <AccountCategory><br>  <UniqueName>K</UniqueName><br>  </AccountCategory><br>  <CommodityCode><br>  <UniqueName>105</UniqueName><br>  </CommodityCode><br>  <Description><br>  <Description>Desc 1</Description><br>  <ItemNumber/><br>  <Price><br>  <Amount>1000.00000</Amount><br>  </Price><br>  <UnitOfMeasure><br>  <UniqueName>EA</UniqueName><br>  </UnitOfMeasure><br>  </Description><br>  <HasAdhocShipToAddress>false</HasAdhocShipToAddress><br>  <ItemCategory><br>  <UniqueName>4</UniqueName><br>  </ItemCategory><br>  <ItemOnReq>1</ItemOnReq><br>  <NumberOnPOString>00001</NumberOnPOString><br>  <ReceivingType>7</ReceivingType><br>  <RequisitionNumber>REQ263</RequisitionNumber><br>  <SAPDistributionFlag/><br>  <SAPPartialInvoiceFlag/><br>  <ShipTo><br>  <PostalAddress><br>  <City>Bangalore</City><br>  <Country><br>  <UniqueName>IN</UniqueName><br>  </Country><br>  <Lines>3 Galaxis, #10-21 Symbiosis</Lines><br>  <PostalCode>138633</PostalCode><br>  <State/><br>  </PostalAddress><br>  <UniqueName>1000_INS2</UniqueName><br>  </ShipTo><br>  </item><br>  </LineItems><br>  <UniqueName>EP182</UniqueName><br>  </item><br>  </ERPOrder_PurchOrdLineDetails_Item><br>  <ERPOrder_PurchOrdLineAddDetails_Item><br>  <item><br>  <LineItems><br>  <item><br>  <NumberOnPOString>00001</NumberOnPOString><br>  <OverTolerance>10</OverTolerance><br>  <UnderTolerance>0</UnderTolerance><br>  </item><br>  </LineItems><br>  <UniqueName>EP182</UniqueName><br>  </item><br>  </ERPOrder_PurchOrdLineAddDetails_Item><br>  <ERPOrder_PurchOrdLineText_Item><br>  <item><br>  <UniqueName>EP182</UniqueName><br>  </item><br>  </ERPOrder_PurchOrdLineText_Item><br>  <ERPOrder_PurchOrdScheduleDetails_Item><br>  <item><br>  <LineItems><br>  <item><br>  <Description><br>  <Price><br>  <Amount>1000.00000</Amount><br>  </Price><br>  </Description><br>  <NeedByDateString/><br>  <NumberOnPOString>00001</NumberOnPOString><br>  <OriginatingSystemLineNumber>0</OriginatingSystemLineNumber><br>  <OriginatingSystemReferenceID/><br>  <Quantity>1.00000</Quantity><br>  <ReceivingType>7</ReceivingType><br>  </item><br>  </LineItems><br>  <UniqueName>EP182</UniqueName><br>  </item><br>  </ERPOrder_PurchOrdScheduleDetails_Item><br>  </PurchaseOrderExportRequest><br>  </soap:Body><br></soap:Envelope>

Request as seen on CURL -

curl -X POST -H 'Content-Type: text/xml;charset=UTF-8' -d '<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

   <soap:Header>

      <wsse:Security soap:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">

         <wsse:BinarySecurityToken EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" ValueType="http://docs.o.....' 'http://mockserver:8080/services/CreatePurchaseOrder'

Yes .. I can see the full request when I print. I have even updated the request to append some characters in the end. That is also reflecting -

stepExecution-stdout    <soap:Envelope 
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
<soap:Header> <Headers xmlns="urn:Ariba:Buyer:vrealm_2067"> 
<variant>vrealm_2067</variant> 
<partition>prealm_2068</partition> </Headers> 
</soap:Header> <soap:Body wsu:Id="id-631385321" 
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
 <PurchaseOrderExportRequest partition="prealm_2067" 
variant="vrealm_2067" xmlns="urn:Ariba:Buyer:vrealm_2067"> 
<ERPOrder_PurchOrdHeaderDetails_Item> <item> 
<CompanyCode> <UniqueName>1000</UniqueName> 
</CompanyCode> 
<CreationDateString>20170227</CreationDateString> 
<Currency> <UniqueName>USD</UniqueName> 
</Currency> 
<OrderMethodCategory>ERPCC</OrderMethodCategory> 
<OriginatingSystem/> <OriginatingSystemReferenceID/> 
<PurchaseGroup> <UniqueName>ARB</UniqueName> 
</PurchaseGroup> <PurchaseOrg> 
<UniqueName>1000</UniqueName> </PurchaseOrg> 
<Supplier> <UniqueName>0000300001</UniqueName> 
</Supplier> <UniqueName>EP182</UniqueName> 
</item> </ERPOrder_PurchOrdHeaderDetails_Item> 
<ERPOrder_PurchOrdAcctDetails_Item> <item> <LineItems>
 <item> <Accountings> <SplitAccountings> <item> 
<Amount> <Amount>1000.00000</Amount> </Amount> 
<CostCenter> <UniqueName>1000210016</UniqueName> 
</CostCenter> <GeneralLedger> 
<UniqueName>0000110000</UniqueName> </GeneralLedger> 
<NumberInCollection>1</NumberInCollection> 
<POLineNumber>00001</POLineNumber> 
<Percentage>100.00000</Percentage> 
<Quantity>1.00000</Quantity> </item> 
</SplitAccountings> </Accountings> 
<ReceivingType>7</ReceivingType> </item> 
</LineItems> <UniqueName>EP182</UniqueName> 
</item> </ERPOrder_PurchOrdAcctDetails_Item> 
<ERPOrder_PurchOrdLineDetails_Item> <item> <LineItems>
 <item> <AccountCategory> 
<UniqueName>K</UniqueName> </AccountCategory> 
<CommodityCode> <UniqueName>105</UniqueName> 
</CommodityCode> <Description> <Description>Desc 
1</Description> <ItemNumber/> <Price> 
<Amount>1000.00000</Amount> </Price> 
<UnitOfMeasure> <UniqueName>EA</UniqueName> 
</UnitOfMeasure> </Description> 
<HasAdhocShipToAddress>false</HasAdhocShipToAddress> 
<ItemCategory> <UniqueName>4</UniqueName> 
</ItemCategory> <ItemOnReq>1</ItemOnReq> 
<NumberOnPOString>00001</NumberOnPOString> 
<ReceivingType>7</ReceivingType> 
<RequisitionNumber>REQ263</RequisitionNumber> 
<SAPDistributionFlag/> <SAPPartialInvoiceFlag/> 
<ShipTo> <PostalAddress> <City>Singapore</City> 
<Country> <UniqueName>SG</UniqueName> </Country>
 <Lines>3 Fusionopolis Way, #10-21 Symbiosis</Lines> 
<PostalCode>138633</PostalCode> <State/> 
</PostalAddress> <UniqueName>1000_SGS2</UniqueName> 
</ShipTo> </item> </LineItems> 
<UniqueName>EP182</UniqueName> </item> 
</ERPOrder_PurchOrdLineDetails_Item> 
<ERPOrder_PurchOrdLineAddDetails_Item> <item> 
<LineItems> <item> 
<NumberOnPOString>00001</NumberOnPOString> 
<OverTolerance>10</OverTolerance> 
<UnderTolerance>0</UnderTolerance> </item> 
</LineItems> <UniqueName>EP182</UniqueName> 
</item> </ERPOrder_PurchOrdLineAddDetails_Item> 
<ERPOrder_PurchOrdLineText_Item> <item> 
<UniqueName>EP182</UniqueName> </item> 
</ERPOrder_PurchOrdLineText_Item> 
<ERPOrder_PurchOrdScheduleDetails_Item> <item> 
<LineItems> <item> <Description> <Price> 
<Amount>1000.00000</Amount> </Price> 
</Description> <NeedByDateString/> 
<NumberOnPOString>00001</NumberOnPOString> 
<OriginatingSystemLineNumber>0</OriginatingSystemLineNumber>
 <OriginatingSystemReferenceID/> 
<Quantity>1.00000</Quantity> 
<ReceivingType>7</ReceivingType> </item> 
</LineItems> <UniqueName>EP182</UniqueName> 
</item> </ERPOrder_PurchOrdScheduleDetails_Item> 
</PurchaseOrderExportRequest> </soap:Body> 
</soap:Envelope>RR

Thanks,

Roopa

Solved Solved
0 10 2,838
1 ACCEPTED SOLUTION

Not applicable

The error was because I was calling HTTP url instead of HTTPS. Proxy is working as expected after making this change. Thanks Anil for your involvement and suggestions.

View solution in original post

10 REPLIES 10

@roopashivappa ,

I have seen this issue earlier. By default, Apigee Edge the proxy generated using SOAP to REST wizard removes empty xml nodes. It might be an issue.

Can you post the expected request, request sent to target server ? You can print the request send to target server to trace console using below statement in Javascript policy. Attache the policy at the end of target endpoint post flow request.

print(context.getVariable('request.content'));

Above information in your question is not enough to understand the issue, If you can post the expected request , request sent to target server will be definetely helpful.

Thanks Anil for your suggestion. I tried the above, its still the same behavior. I have updated my question with the original request and request sent to target server. Please have a look at it and let me know if this is something you experienced earlier.

@roopashivappa , My bad, Earlier, I was referring to SOAP to REST. Ideally, SOAP Passthrough proxy should work out of the box. Did you get a chance to compare ideal request vs apigee request ? What does trace say ? Did you get a chance to compare request sent by Apigee vs Direct request to backend ?

This is the request sent to the backend - As you can see , the request is truncated. This is as shown in the trace ui. But when I do assign message and read the request.content .. I can see the full payload on the trace ui, but the same is not being passed to the target 😞

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

   <soap:Header>

      <wsse:Security soap:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">

         <wsse:BinarySecurityToken EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" ValueType="http://docs.o.....'

@roopashivappa , Trace UI always shows truncated API Request / Response. Apigee does send the full request to target server.

Use trace console & print it to console using javascript policy,

print(context.getVariable('request.content'));

Let me know what do you see, Let me know if you need any help with viewing the trace console output in the UI. Issue might be somthing different here. Keep us posted.

@Anil Sagar

Hi Anil,

I have posted the console output. Please have a look.

@roopashivappa , Console output info is not enough to find out exact issue, Community here neither have access to your org nor to the backend service to reproduce this issue to figure out what's going on. Did you get a chance to compare request sent by Apigee vs Direct request to backend ? Do you see any differences ? That might give you some clues.

Not applicable

The error was because I was calling HTTP url instead of HTTPS. Proxy is working as expected after making this change. Thanks Anil for your involvement and suggestions.

Anytime, Glad to know issue is resolved. Keep us posted moving forward if any.

Hello roopashivappa

I didn't get you point about HTTP/HTTPS. Did you mean you have to call the proxy in the secure mode, https://proxy ?

I'm having the same issue and my proxy is on HTTPS, however my target endpoint is Apache secure server that redirects the incoming requests to the final target backend service which is not secure.

I still cannot figure out the dependence between proxy or backend's URL in request's truncating.

Best regards,

Wadii TAHRI