{ Community }
  • Academy
  • Docs
  • Developers
  • Resources
    • Community Articles
    • Apigee on GitHub
    • Code Samples
    • Videos & eBooks
    • Accelerator Methodology
  • Support
  • Ask a Question
  • Spaces
    • General
    • Edge/API Management
    • Developer Portal
    • API Design
    • APIM on Istio
    • Extensions
    • Business of APIs
    • Academy/Certification
    • Analytics
    • Events
    • Integration (AWS, PCF, Etc.)
    • Microgateway
    • Monetization
    • Private Cloud Deployment
    • Insights
    • IoT Apigee Link
    • BaaS/Usergrid
    • BaaS Transition/Migration
    • Apigee-127
    • New Customers
    • Topics
    • Questions
    • Articles
    • Ideas
    • Leaderboard
    • Badges
  • Log in
  • Sign up

Get answers, ideas, and support from the Apigee Community

  • Home /
  • Edge/API Management /
avatar image
2
Question by Venu.Pujari1 · Sep 25, 2015 at 03:31 AM · 2.1k Views node.jsjavascriptjava calloutextractvariablesassignmessage

How to extract SOAP response attachment?

Hi, I am getting SOAP body with attachment from my target endpoint. I want to extract only attachment content and pass it client.

Is anyone have example how to process this through APIGEE Edge?

Thanks,

Venu

Comment
Add comment
10 |5000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by Apigeeks only
  • Viewable by the original poster
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Close

3 Answers

· Add your answer
  • Sort: 
avatar image
1

Answer by coverbeck · Sep 25, 2015 at 06:26 PM

Hi @Venu.Pujari1,

You can generate a proxy for a WSDL in the UI and follow that pattern. There are some example WSDLs you can choose from when you click on the + API Proxy button.

If you don't want to do that, essentially what those proxies do are to convert the SOAP response to JSON with an XMLtoJSON policy, then extract the body thusly with an ExtractVariables policy:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ExtractVariables async="false" continueOnError="false" enabled="true" name="get-response-soap-body">
    <DisplayName>Get Response SOAP Body</DisplayName>
    <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
    <JSONPayload>
        <Variable name="body">
            <JSONPath>$.Envelope.Body</JSONPath>
        </Variable>
    </JSONPayload>
    <Source>response</Source>
    <VariablePrefix>soapresponse</VariablePrefix>
</ExtractVariables>

Then set the response:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<AssignMessage async="false" continueOnError="false" enabled="true" name="set-response-soap-body">
    <DisplayName>Set Response SOAP Body</DisplayName>
    <Set>
        <Payload contentType="application/json">{soapresponse.body}</Payload>
    </Set>
    <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
    <AssignTo createNew="false" transport="http" type="request"/>
</AssignMessage>

Comment
Add comment · Link
10 |5000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by Apigeeks only
  • Viewable by the original poster
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by Venu.Pujari1 · Sep 25, 2015 at 06:41 PM

@coverbeck

Thanks for your time looking into this issue. As i have mentioned I am getting SOAP response with attachment.The customer wants the SOAP attachment as a SOAP Body the soap body which is existed need to clear before substitution.FYI. I am attaching the SOAP response which was returned from backend.

Thanks,

Venu


soapattachmentnew.txt (87.2 kB)
Comment
Add comment Show 1 · Link
10 |5000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by Apigeeks only
  • Viewable by the original poster
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image coverbeck ♦ · Sep 25, 2015 at 08:17 PM 0
Link

Sorry, I had skimmed your original question, and I haven't used SOAP attachments before. Looking at your sample SOAP response, there are 2 XML root elements in the response. I don't know how you can handle that off-hand other than through a JavaScript policy.

avatar image
0

Answer by Venu.Pujari1 · Sep 25, 2015 at 08:21 PM

@coverbeck

Thanks a lot Coverveck!.

When i use jmeter SOAP/XML-RPC Request to hit the backend server,i am getting the SOAP response as two parts,soap body followed by soap attachment.

Thanks,

Venu

Comment
Add comment Show 3 · Link
10 |5000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by Apigeeks only
  • Viewable by the original poster
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Venu.Pujari1 · Sep 25, 2015 at 08:24 PM 0
Link

I am sorry I mis spelled your name .

Thanks a lot for your quick response!

avatar image coverbeck ♦ · Sep 25, 2015 at 08:36 PM 0
Link

Oh, I see, the response is content-type multipart/Related?

I'm guessing you'll have to separate out the parts of the response then in a JavaScript/Java callout/Python policy (Java callout and Python policies are only available in Apigee Edge; I don't know what you are on), and then just use the attachment part in the response.

I haven't actually done this, but it sounds like it should be possible.

avatar image Venu.Pujari1 coverbeck ♦ · Sep 25, 2015 at 08:41 PM 0
Link

@coverbeck

I am trying with javacallout policy,but failing to retrieve the attachment.If you have any reference java/js/py can you please share with me the examples

Thanks,

Venu

Your answer

Hint: You can notify a user about this post by typing @username

Up to 5 attachments (including images) can be used with a maximum of 5.0 MB each and 25.0 MB total.

Follow this Question

Answers Answers and Comments

34 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

What is the plan/policy for upgrading node.js on Apigee Edge? 2 Answers

Is it possible to use Uint8Array from within a javascript callout? 1 Answer

Introduce Delay or wait for reponse from backend using javascript.. 1 Answer

Feasibility of JDBC connectivity from Apigee Edge Using Java Callout Policy 1 Answer

How to implement concurrent/parallel calls to multiple rest APIs(backend) using JavaScript and merge the response from the all the backend APIs? 2 Answers

  • Products
    • Edge - APIs
    • Insights - Big Data
    • Plans
  • Developers
    • Overview
    • Documentation
  • Resources
    • Overview
    • Blog
    • Apigee Institute
    • Academy
    • Documentation
  • Company
    • Overview
    • Press
    • Customers
    • Partners
    • Team
    • Events
    • Careers
    • Contact Us
  • Support
    • Support Overview
    • Documentation
    • Status
    • Edge Support Portal
    • Privacy Policy
    • Terms & Conditions
© 2019 Apigee Corp. All rights reserved. - Apigee Community Terms of Use - Powered by AnswerHub
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Create an article
  • Post an idea
  • Spaces
  • General
  • Edge/API Management
  • Developer Portal
  • API Design
  • APIM on Istio
  • Extensions
  • Business of APIs
  • Academy/Certification
  • Analytics
  • Events
  • Integration (AWS, PCF, Etc.)
  • Microgateway
  • Monetization
  • Private Cloud Deployment
  • Insights
  • IoT Apigee Link
  • BaaS/Usergrid
  • BaaS Transition/Migration
  • Apigee-127
  • New Customers
  • Explore
  • Topics
  • Questions
  • Articles
  • Ideas
  • Members
  • Badges