Retrieve soap attachment with talend - soap

I've defiened a web service in talend and I try to get the soap attachment of the request to this service but I don't know how to do. The file is an XMl.
When I look the request I received in talend I've this :
<ser:createSharePointFileOperationRequest xmlns:ser="http://www.talend.org/service/">
<relativeServerPath>/facturation</relativeServerPath>
<listName>Facture</listName>
<fileName>Structure.xml</fileName>
<content><inc:Include xmlns:inc="http://www.w3.org/2004/08/xop/include" href="cid:Structure.xml"></inc:Include></content>
<!--1 or more repetitions:-->
<metadata Name="titre">TitreTest</metadata>
<metadata Name="code">015</metadata>
</ser:createSharePointFileOperationRequest>
Do you know if there is a way to get this file?

You can try to use tFileFetch component after the soap call. You'll have to extract url field from the response and transmit it to the tFileFetch component.
You won't be able to directly retrieve the file from the soap call itself.

Related

How to add the SOAP envelope and body for exchange object, while sending to the MQ with Apache Camel in Spring Boot App

I wanna send message to the MQ with SOAP format but in exchange object i'll get only XML Data (without envelope,header and body), here i have to append the SOAP envelope and body to the exchange object as like below.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:act="http://ei/event/envprocess">
<soapenv:Header/>
<soapenv:Body>
**// exchange object get the xml data need to add here.**
</soapenv:Body>
</soapenv:Envelope>
for solution i found this link but i'm not getting how to get the cxf:cxfEndpoint object in spring boot and how to append payload or exchange data for it.
Can anyone please help me to resolve this issue.
As mentioned in the comment, you can use XSL to transform your message body into a SOAP request.
To call the XSL in the route is a one-liner:
.to("xslt:MyStylesheet.xsl?saxon=true")
This expects the MyStylesheet.xsl in the classpath root. If you want to leverage XSL 2, add the Saxon dependency and the option saxon=true.
If you only need XSL 1, you don't need Saxon and the option.
The solution you found would be to establish a SOAP communication through a JMS broker. In this scenario, MQ mimics a synchronous request/reply communication. This is a quite different subject than using standard MQ (asychronous sender and receiver).
If the simple XSL or SOAP over JMS better suits you case depends on the broader goal you want to reach.

Using Insomnia To Make Soap Calls

I am trying to use Insomnia to make soap calls - specifically trying to get post to succeed. I defined the URL as the end point and put the body type as XML with the SOAP contents (envelope, header, body). I defined the user id and password in the header. When I run I get 415 Unsupported Media Type. I can't really paste the soap contents because of all of the URL addressing in the envelope. I am using Insomnia to succeed in doing the REST call to get my information (for some crazy reason the gets are REST but the posts are SOAP) but can't get the insert to work. Is there something special I need, or does Insomnia not support SOAP post transactions? I googled and it appears in 2018 this was added. I don't have the WSDL available.
I appreciate this is not giving lots of information so guidance on what more I may provide to get assistance will also be helpful. Has anyone succeeded in using Insomnia to make SOAP calls?
All that was needed for me to make it work was:
Request method: POST.
Setting the Content-Type header to text/xml; charset=utf-8 (application/xml gave me the 415 response).
Wrapping request body in proper SOAP envelope.
You should be able to call GET on YourHandler.asmx to look up envelopes for requests you want to use. Envelope should look somewhat like this:
<?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>
<HelloWorld xmlns="http://tempuri.org/">
<foo>
<Id>1</Id>
<Name>Bar</Name>
</foo>
</HelloWorld>
</soap:Body>
</soap:Envelope>
Credits for the guidance and envelope sample goes to this answer.
You can import the WSDL file, so that all methods, headers etc. will be created automatically. Click on:
Go to dashboard
Click Create
Choose URL (under import from)
Paste the WSDL URL and click Fetch and Import
As an example you can use the following URL: http://www.dneonline.com/calculator.asmx?wsdl
You will get this:
The problem as of writing this answer is, that there are two bugs:
Not all WSDL URLs are getting imported correctly (e.g. this one works in SOAP UI, but not in Insomnia http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso?WSDL)
The methods are getting imported, but they don't work
You can submit and issue on Github, so that this is getting fixed: https://github.com/Kong/insomnia

How to upload a attached file using Jmeter for SOAP

I need to upload a file(xml) using jmeter. I know how to do it for REST calls. But this is for SOAP request.
The request xml looks like,
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsdl="http://wsdl.api.doc.cdp.ipt.homeoffice.org/">
<soapenv:Header/>
<soapenv:Body>
<wsdl:createDocument>
<input>
<instanceId>999</instanceId>
<sessionId>999</sessionId>
<content>file:aaa.xml</content>
<mimetype>xml</mimetype>
</input>
</wsdl:createDocument>
</soapenv:Body>
</soapenv:Envelope>
Easy one: just record your call using JMeter's Proxy Server or Mobile Recorder service and replay it
Harder one: create POST request manually, switch HTTP Request sampler to "Body Data" mode and construct it there like:
See Insert MTOM Attachment for more details.
Hardest one: use JSR223 Sampler and Groovy language to generate request on-the-fly (it'll be required if your SOAP server is a little bit paranoid and expect security header with timestamps, expiration date, usernames tokens, etc.)
you can use web service soap request sampler to post it (check here) or you can try Http request sampler, please check here for handling it

Using JMeter SOAP/XML-RPC Request to call ChemSpell Web Service

I'm trying to test the web service api for a free service called ChemSpell. I am trying to use JMeter's SOAP/XML-RPC Request option to test it. I am a bit new at this and not sure what to enter in. The call expects two parameters, which for testing purposes I want to set to the following:
Name = "formeldehyde"
Source = "All databases"
Based on their site I'm putting "http://chemspell.nlm.nih.gov:80/axis/SpellAid.jws" for the URL and "http://chemspell.nlm.nih.gov" in Send SOAPAction. I'm not sure how to configure the "Soap/XML-RPC Data" portion. I'm thinking the WSDL file they provide should give me everything I need to configure that section, but I'm not exactly sure how. Any help is much appreciated!
You need to create the xml that will be sent to the webservice, based on the wsdl, and paste it in the SOAP/XML-RPC data field.
The xml will describe the method call you wish to make and the data you wish to pass to it.
It will look like this (you will need to replace ? with data):
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:spel="http://chemspell.nlm.nih.gov/axis/SpellAid.jws/axis/SpellAid.jws">
<soapenv:Header/>
<soapenv:Body>
<spel:getSugList soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<name xsi:type="xsd:string">?</name>
<src xsi:type="xsd:string">?</src>
</spel:getSugList>
</soapenv:Body>
</soapenv:Envelope>
The easiest way to generate blank requests like the above is using SOAP UI. You just give the wsdl URL and it generates all possible requests for you. I copy and paste these over to JMeter.

Create WSDL message from SOAP Response

I have a WSDL that contains a different response then the actual responds with. I want to update the WSDL with the format of the API response but am having trouble. Is there a tool to generate a WSDL response from SOAP XML?
I should mention that they gave me the WSDL as a file, no public WSDL is visible.
The response contains this unknown anonymous xml element, s-gensym3. It should be userid.
If it's a .NET web service you can browse to [serviceurl]?WSDL to get the WSDL.
There's surely service endpoint you communicate with. You shall be able to invoke this endpoint in the browser and add to the end:
?wsdl
i.e. http://service:8123/operationName?wsdl
This will print you entire WSDL. Just make sure you have the same and you're done.