Wso2 response soapenv:Envelope was missed - wso2

I am using Wso2 EI 7.1.0, I implemented case like EI will get soap request that request will convert to json request then it will send to endpoint, from the endpoint EI will get json response that will convert to soap message again before responded to client. So here
Expected Response:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<message>
<response>success</response>
</message>
</soapenv:Body>
</soapenv:Envelope>
Getting Response:
<message>
<response>success</response>
</message>
Here soap tags are missing , So please update.
Thanks,
Ajay Babu Maguluri.

Most likely you are sending WSO2 a request with Content-Type application/xml (implying plain XML) So it will respond with a plain xml message without Soap envelope. In Postman try to set the content-type to text/xml.

Related

Webservice SOAP XML request not work in Axis2 Webservice

I have a request with SOAPUI, work good:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:webservice">
<soapenv:Header/>
<soapenv:Body>
<urn:Notificacion>
<as_xml_peticion><![CDATA[<G_PETICION>
<CABECERA>
<NOTIFICADOR>API</NOTIFICADOR>
</CABECERA>
</G_PETICION>]]>
</as_xml_peticion>
But when I make a Axis2 Webservice client java with WSDL:
String xml = <![CDATA[<G_PETICION>
<CABECERA>
<NOTIFICADOR>API</NOTIFICADOR>
</CABECERA>
</G_PETICION>]]>;
tnofication.setAs_xml_peticion(xml);
notification.setNotificacion(tnofication);
WebserviceStub.NotificacionResponse response = proxy.notificacion(notification);
the response is:
Connection has been shutdown: javax.net.ssl.SSLException: java.net.SocketException: Connection reset
What is the problem?

how to change soap 1.2 response from wso2 authorization of token

I am getting the following response if I pass the wrong token to API in SOAP 1.2 format
<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Body>
<soapenv:Fault>
<soapenv:Code>
<soapenv:Value>**soapenv:Client**</soapenv:Value>
</soapenv:Code>
<soapenv:Reason>
<soapenv:Text xml:lang="en">Authentication Failure</soapenv:Text>
</soapenv:Reason>
<soapenv:Detail>Access failure for API: ***/1.0, version: 1.0 status: (900901) - Invalid Credentials</soapenv:Detail>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
instead of soapenv:Client we need soapenv:Sender how it is possible?
soapenv:Client is the default value that is sent from the code itself. See [1]. This can be changed by writing a custom APIAuthenticationHandler. Please refer [2] for information.
[1] https://github.com/wso2/carbon-apimgt/blob/master/components/apimgt/org.wso2.carbo[…]/apimgt/gateway/handlers/security/APIAuthenticationHandler.java
[2] https://apim.docs.wso2.com/en/latest/develop/extending-api-manager/extending-gateway/writing-custom-handlers/#writing-a-custom-handler

Error calling WSO2 API Manager Admin Servces via soapUI

I am experiencing an error calling WSO2 API Manager v2.1.0 Admin Services via soapUI. It seems that the requests that are changing state in API Manager like this one, addRole, are failing. Note that "read only" style requests like listAllUsers or getAllRolesNames are succeeding.
Here is the raw request from soapUI:
POST https://localhost:9443/services/UserAdmin.UserAdminHttpsSoap11Endpoint HTTP/1.1
Accept-Encoding: gzip,deflate
SOAPAction: "urn:addRole"
Authorization: Basic YWRtaW46YWRtaW4=
Content-Type: application/soap+xml
Content-Length: 283
Host: localhost:9443
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://org.apache.axis2/xsd">
<soapenv:Header/>
<soapenv:Body>
<xsd:addRole>
<xsd:roleName>test_role</xsd:roleName>
</xsd:addRole>
</soapenv:Body>
</soapenv:Envelope>
Here is the response form soapUI:
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
<wsa:Action>http://www.w3.org/2005/08/addressing/soap/fault</wsa:Action>
</soapenv:Header>
<soapenv:Body>
<soapenv:Fault>
<soapenv:Code>
<soapenv:Value>soapenv:VersionMismatch</soapenv:Value>
</soapenv:Code>
<soapenv:Reason>
<soapenv:Text xml:lang="en-US">Transport level information does not match with SOAP Message namespace URI</soapenv:Text>
</soapenv:Reason>
<soapenv:Detail/>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
Here is the log entry that appears in wso2carbon.log:
[2017-03-03 16:23:03,474] ERROR - ResponseTimeCalculator wso2statistics.request.received.time is null in the IN MessageContext
Any help is greatly appreciated.
Thanks!
Looks like your request is a SOAP 1.1.
In that case, the Content-Type of the request should be text/xml, not application/soap+xml.
If that doesn't work, try using RemoteUserStoreManagerService instead of UserAdmin.

Oracle Service Bus - Decoding of MIME attachments from MIME Content-Transfer-Encoding='7bit' not supported

I've developed a proxy service in OSB 12c with MTOM enabled
I can send binary files successfully as pdf, doc, ppt or xls, but as soon as I send a text file the following error arises:
REQUEST:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:upl="http://UploadFileService.acme/">
<soap:Header/>
<soap:Body>
<upl:scanDocRequest>
<requestMsg>
<doc>cid:719461305114</doc>
</requestMsg>
</upl:scanDocRequest>
</soap:Body>
</soap:Envelope>
RESPONSE:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Body>
<con:fault xmlns:con="http://www.bea.com/wli/sb/context">
<con:errorCode>OSB-382118</con:errorCode>
<con:reason>Decoding of MIME attachments from MIME Content-Transfer-Encoding='7bit' not supported</con:reason>
<con:location>
<con:node>AntivirusPipelinePairNode</con:node>
<con:pipeline>request-a00020f.N696e5fe3.0.15143454755.N8000</con:pipeline>
<con:stage>ReportingIn</con:stage>
<con:path>request-pipeline</con:path>
</con:location>
</con:fault>
</soap:Body>
</soap:Envelope>
Response fails with
Decoding of MIME attachments from MIME Content-Transfer-Encoding='7bit' not supported
Content-type = application/octet-stream instead of plain/text solved my problem

Create a Custom SoapFault error message in the response for camel cxf webservice

I am working on a camel based cxf-webservice. I have to show all types of error messages in my responses which I am doing properly in my service layer. But if a request is invalidated still I was getting a correct response.
For the following type of request
<soapenv:Body>
...
<!--Optional:-->
<prod:CandidateMaximumQuantity/>
<!--Optional:-->
<prod:CandidatePerPageMaximumQuantity>100</prod:CandidatePerPageMaximumQuantity>
<!--Optional:-->
<prod:CandidateDisplayStartSequenceNumber>1</prod:CandidateDisplayStartSequenceNumber>
...
</soapenv:Body>
In the soap validator i am getting invalid decimal value. expected at least one digit.
After writing the following code in my cxf-context I am able to do the input request validation.
But in the response I
<cxf:properties>
<entry key="allowStreaming" value="false" />
<entry key="schema-validation-enabled" value="${isSchemaValidationEnabled}" />
</cxf:properties>
Where isSchemaValidationEnabled = true.
So I am getting the following response in my SOAP UI.
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<soap:Fault>
<faultcode>soap:Client</faultcode>
<faultstring>Unmarshalling Error: cvc-datatype-valid.1.2.1: '' is not a valid value for 'integer'.</faultstring>
</soap:Fault>
</soap:Body>
My requirement is to create custom error message, so that I can propagate the SOAP error in to my response.And I can show a format of following message
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<prod:Response ServiceVersionNumber=" " xmlns:prod="****">
<prod:TransactionDetail>
<prod:ApplicationTransactionID>***Request</prod:ApplicationTransactionID>
<prod:ServiceTransactionID/>
<prod:TransactionTimestamp>2015-05-05T05:33:52</prod:TransactionTimestamp>
</prod:TransactionDetail>
<prod:TransactionResult>
<prod:SeverityText>Error</prod:SeverityText>
<prod:ResultID>CM018</prod:ResultID>
<prod:ResultText>No candidates resulted for the given input criteria.</prod:ResultText>
<prod:ResultMessage>
<prod:ResultDescription>List of service interface is not available for the given Service name or Service Version number</prod:ResultDescription>
</prod:ResultMessage>
</prod:TransactionResult>
</prod:Response>
Please someone respond to the query.