(Wso2 Api Manager 2.6.0) How to send a list of string as input using mediator? - api

(Wso2 Api Manager 2.6.0) How to send a list of string as input using mediator?
I have a Api and my api have a list of string for input.
my api is soap.
I think mediator can help me.
I want a mediator for this api.
for example this is my input:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/" xmlns:arr="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<soapenv:Header/>
<soapenv:Body>
<tem:GetData>
<!--Optional:-->
<tem:value>
<!--Zero or more repetitions:-->
<arr:string>a</arr:string>
<arr:string>s</arr:string>
<arr:string>f</arr:string>
</tem:value>
</tem:GetData>
</soapenv:Body>
</soapenv:Envelope>
and this is my output
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<GetDataResponse xmlns="http://tempuri.org/">
<GetDataResult>You entered: a s f</GetDataResult>
</GetDataResponse>
</s:Body>
</s:Envelope>

Related

How to add custom object for workday API for Edit_Worker_additional_Data

SOAP based XML file :
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:bsvc="urn:com.workday/bsvc" xmlns:cus="urn:com.workday/tenants/super/data/custom">
<soapenv:Header>
<bsvc:Workday_Common_Header>
<bsvc:Include_Reference_Descriptors_In_Response>1</bsvc:Include_Reference_Descriptors_In_Response>
</bsvc:Workday_Common_Header>
</soapenv:Header>
<soapenv:Body>
<bsvc:Edit_Worker_Additional_Data_Request bsvc:version="v36.0">
<bsvc:Business_Process_Parameters>
<bsvc:Auto_Complete>true</bsvc:Auto_Complete>
<bsvc:Run_Now>true</bsvc:Run_Now>>
<bsvc:Comment_Data>
<bsvc:Comment>Test comment on 27 March- attempt2</bsvc:Comment>
</bsvc:Comment_Data>
</bsvc:Business_Process_Parameters>
<bsvc:Worker_Custom_Object_Data>
<bsvc:Effective_Date>2021-03-25</bsvc:Effective_Date>
<bsvc:Worker_Reference bsvc:Descriptor="Employee_ID">
<bsvc:ID bsvc:type="Employee_ID">123</bsvc:ID>
</bsvc:Worker_Reference>
<bsvc:Business_Object_Additional_Data>
<cus:ContractData>
<cus:contractDate>2021-03-23</cus:contractDate>
<cus:wd002AddendumEffectiveDate2>2021-05-23</cus:wd002AddendumEffectiveDate2>
<cus:commissionRates>22.25</cus:commissionRates>
</cus:ContractData>
</bsvc:Business_Object_Additional_Data>
</bsvc:Worker_Custom_Object_Data>
</bsvc:Edit_Worker_Additional_Data_Request>
</soapenv:Body>
</soapenv:Envelope>
C# code:
`ServiceReference1.Edit_Worker_Additional_DataInput data = new ServiceReference1.Edit_Worker_Additional_DataInput(); data.Edit_Worker_Additional_Data_Request.Worker_Custom_Object_Data.Business_Object_Additional_Data.Any=
new System.Xml.XmlElement[] { };`
How to store soap xml file data in "System.Xml.XmlElement[]" array ?

how to override axis2 service response return parameter name

I have upgraded my web services from apache axis1 to axis2, but I wanted to send the same response as it was earlier.
My axis1 response looks like below
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<testServiceResponse xmlns="http://webservices.com.test.com">
<testServiceReturn>SUCCESS</testServiceReturn>
</testServiceResponse>
</soapenv:Body>
</soapenv:Envelope>
and My axis2 response is
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<ns:testServiceResponse xmlns:ns="http://webservices.com.test.com">
<ns:return>SUCCESS</ns:return>
</ns:testServiceResponse>
</soapenv:Body>
</soapenv:Envelope>
I still wanted to send the response tag as 'testServiceReturn' instaed of 'return'.
Thanks in advance.

FaultException not thrown, or even any other Exception

WCF client consuming a SOAP service from third party (Java implementation).
WSDL generated proxy via add service reference. 4.5 Framework.
Message intercepted via AfterReceiveReply, which .ToString() is as follows :-
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:v1="http://group.customer.com/contract/vbo/header/v1">
<v1:Destination>
<!--Optional:-->
<v1:CountryCode>USA</v1:CountryCode>
<!--Optional:-->
<v1:LanguageCode>eng</v1:LanguageCode>
<!--Optional:-->
<v1:Operator>customer</v1:Operator>
<!--Optional:-->
<v1:Division>CustomerManagement</v1:Division>
<!--Optional:-->
<v1:System>CRM</v1:System>
<!--Optional:-->
<v1:Timestamp>2015-03-30T09:30:10Z</v1:Timestamp>
</v1:Destination>
<v1:Cache>
<v1:UseCache>yes</v1:UseCache>
<v1:MaxAge>86400000</v1:MaxAge>
<v1:LastModified>2014-05-30T09:30:10Z</v1:LastModified>
</v1:Cache>
<v1:Correlation>
<v1:ConversationID>382978e8-f061-435c-bc7f-1001</v1:ConversationID>
</v1:Correlation>
<v1:Source>
<v1:CountryCode>GB</v1:CountryCode>
<v1:Operator>customer</v1:Operator>
<v1:Division>CustomerManagement</v1:Division>
<v1:System>ccc</v1:System>
<v1:Timestamp>2015-03-30T09:30:10Z</v1:Timestamp>
<v1:Identity>
<v1:Token>a.user#xxx.com</v1:Token>
</v1:Identity>
</v1:Source>
<wsa:Action>action_anonymized</wsa:Action>
<wsa:MessageID>uuid:2b97effe-f997-4424-b996-436067bf515c</wsa:MessageID>
<wsa:RelatesTo>uuid:e6dd9c95-53e7-4a5a-8361-c233f494a788</wsa:RelatesTo>
<To xmlns="http://www.w3.org/2005/08/addressing">http://www.w3.org/2005/08/addressing/anonymous</To>
</soap:Header>
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<ns0:Fault xmlns:ns1="http://www.w3.org/2003/05/soap-envelope" xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/">
<faultcode>OSB-101</faultcode>
<faultstring>OSB ERROR</faultstring>
<detail>
<ns0:Fault xmlns:ns0="http://group.customer.com/contract/vfo/fault/v1" xmlns:ns2="http://group.customer.com/contract/vho/header/v1" xmlns:ns3="http://group.customer.com/schema/common/v1" xmlns:ns6="http://docs.oasis-open.org/wsrf/bf-2" xmlns:ns7="http://www.w3.org/2005/08/addressing">
<ns6:Timestamp>2017-03-09T08:32:28.788Z</ns6:Timestamp>
<ns6:ErrorCode>500</ns6:ErrorCode>
<ns0:Name />
<ns0:Severity>Critical</ns0:Severity>
<ns0:Category>Technical</ns0:Category>
<ns0:ReasonCode>ReasonCode</ns0:ReasonCode>
<ns0:Message>The Contact ID [666888777] with Contact Login [null] doesnot exist in the CIAM system.</ns0:Message>
</ns0:Fault>
</detail>
</ns0:Fault>
</soapenv:Body>
</s:Body>
</soapenv:Envelope>
Although I can intercept this and raise (edit:throw) an exception, i would like to figure out why this is not being raised normally, i.e the Message.isFault is false for this response, whereas others that 'look' identical for other service fault responses do have the .isFault true and FaultExeception is caught.
I checked the existance of the service/method for the [FaultContractAttribute] :-
[System.ServiceModel.FaultContractAttribute(typeof(CSUAccount.FaultType), Action="action_anonymised", Name="Fault", Namespace="http://group.customer.com/contract/vfo/fault/v1")]
This was a provider issue, the server was not setting this response as a fault. I have no knowledge of what the server issue was, apart from the provider telling me that it was 'fixed'

MuleSoft WebServiceComsumer pass Header

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:WS_CONFIG_AX">
<soapenv:Header>
<urn:AuthenticationInfo>
<urn:userName>USERNAME</urn:userName>
<urn:password>PASSWORD</urn:password>
<!--Optional:-->
<urn:authentication/>
<!--Optional:-->
<urn:locale/>
<!--Optional:-->
<urn:timeZone/>
</urn:AuthenticationInfo>
</soapenv:Header>
<soapenv:Body>
<urn:GetList_Operation_1>
<urn:Qualification>'TYPE' = "Service Request"</urn:Qualification>
<urn:startRecord>0</urn:startRecord>
<urn:maxLimit>1</urn:maxLimit>
</urn:GetList_Operation_1>
</soapenv:Body>
Using WebServiceConsumer I have to pass the username and password. I am not sure which to send. Can I use transform message or have to use a different method?
You can add a property named soap.AuthenticationInfo before constructing the payload and pass it to the wsconsumer.
See below: Here the payload should be constructed as the object AuthenticationInfo.
<set-property propertyName="soap.AuthenticationInfo" value="#[payload]" doc:name="Property" />
After this construct your soap body (using dataweave or something) and pass it to the wsconsumer.
Check the section Adding custom headers in the below link:
https://docs.mulesoft.com/mule-user-guide/v/3.6/web-service-consumer

WSDL file and SOAP headers

I have a wsdl file here: "obscured"
I was wondering how can I get the SOAP headers from this file? This looks very cryptic to me, so if someone can point me to a tutorial, it would be great. All I want this is soap string that I need to pass into NSURLConnection, I can do the parsing using NSXMLParser.
For example, this tutorial here: http://www.icodeblog.com/2008/11/03/iphone-programming-tutorial-intro-to-soap-web-services/ shows how to to it, but it doesn't show how to get the SOAP message from the wsdl file.
Thanks!
Download SOAPUI Application (Available for both MAC and PC) from http://www.soapui.org/. I gave that WSDL to SOAP UI and I see GetAdvertisers, GetPlans, GetPlansByAdvertiser,GetReportPostBuy, HelloWorld,Login. For which one are you looking to get SOAP Request. SOAP UI constructs sample request for you. Check it out. If you are having difficulty, for now I am posting all those requests here:
GetAdvertisers:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:mss="http://MSS">
<soapenv:Header/>
<soapenv:Body>
<mss:GetAdvertisers>
<mss:userID>?</mss:userID>
</mss:GetAdvertisers>
</soapenv:Body>
</soapenv:Envelope>
GetPlans:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:mss="http://MSS">
<soapenv:Header/>
<soapenv:Body>
<mss:GetPlans>
<mss:userID>?</mss:userID>
</mss:GetPlans>
</soapenv:Body>
</soapenv:Envelope>
GetPlansByAdvertiser:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:mss="http://MSS">
<soapenv:Header/>
<soapenv:Body>
<mss:GetPlansByAdvertiser>
<mss:UserID>?</mss:UserID>
<!--Optional:-->
<mss:Advertiser>?</mss:Advertiser>
</mss:GetPlansByAdvertiser>
</soapenv:Body>
</soapenv:Envelope>
GetReportPostBuy:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:mss="http://MSS">
<soapenv:Header/>
<soapenv:Body>
<mss:GetReportPostBuy>
<mss:UserID>?</mss:UserID>
<mss:PlanID>?</mss:PlanID>
<mss:CompanyID>?</mss:CompanyID>
<!--Optional:-->
<mss:CompanyName>?</mss:CompanyName>
<mss:AdvertiserID>?</mss:AdvertiserID>
<!--Optional:-->
<mss:AdvertiserName>?</mss:AdvertiserName>
<mss:PubdateFrom>?</mss:PubdateFrom>
<mss:PubdateTo>?</mss:PubdateTo>
</mss:GetReportPostBuy>
</soapenv:Body>
</soapenv:Envelope>
Login:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:mss="http://MSS">
<soapenv:Header/>
<soapenv:Body>
<mss:Login>
<!--Optional:-->
<mss:username>?</mss:username>
<!--Optional:-->
<mss:password>?</mss:password>
</mss:Login>
</soapenv:Body>
</soapenv:Envelope>