SOAP UI validates improper fault structure - validation

Can you help me understand why SOAP UI (v4.0.1) validates the below structure even though it should be non compliant to standard schema
<soapenv:Body>
**<code>FOUTNUMMER : RRC073</code>**
<soapenv:Fault>
<faultcode>soapenv:Client</faultcode>
<faultstring>Provider Error Occured.</faultstring>
</soapenv:Fault>
</soapenv:Body>

Related

How to remove unwanted namespaces and change the namespace location in Spring Web Service requests

I am working on a Spring Web services client, which is making a SOAP requests.
The project contains a wsdl file which references 2 versions of xsd files. The issue we are observing is that the generated request includes all the namespaces, even those which are not applicable. Also we want the namespaces to appear in SOAP-ENV. Below are sample actual and expected requests with dummy data.
EmployeeSearchRequest is defined in empService-v1-1.xsd
Actual Request:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header>
...
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<ns6:EmployeeSearchRequest xmlns:ns2="http://employee-info.com/emp/xsd/2014/05" xmlns:ns3="http://employee-info.com/emp/common/xsd/2014/09" xmlns:ns4="http://employee-info.com/emp/xsd/2011/04" xmlns:ns5="http://employee-info.com/emp/wsdl/empService-v1-0" xmlns:ns6="http://employee-info.com/emp/wsdl/empService-v1-1">emp1</ns6:EmployeeSearchRequest>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Expected Request:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="http://employee-info.com/emp/common/xsd/2014/09" xmlns:ns2="http://employee-info.com/emp/wsdl/empService-v1-1">
<SOAP-ENV:Header>
...
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<ns2:EmployeeSearchRequest>emp1</ns2:EmployeeSearchRequest>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
I could not figure out how can I achieve the expected request format. Could not find solutions online as well.
This is first time I am working on SOAP web service.
Please help.

How to set SOAP Envelope Header in Spring Integration with data from int-http:inbound-gateway?

I tried to build a simple spring integration project where I get a REST request and convert it to a SOAP request. Something like:
<int-http:inbound-gateway id="rest-inbound-gateway" request-channel="restRequestChannel"
reply-channel="restOutputChannel" supported-methods="POST"
path="/somepath" request-payload-type="com.something.RequestObject">
<int-http:request-mapping consumes="application/json" produces="application/json" />
</int-http:inbound-gateway>
<int:transformer ref="RestToSoapTransformer" method="transform"
input-channel="restRequestChannel" output-channel="transformedChannel"/>
<int-ws:outbound-gateway id="marshallingGateway"
request-channel="transformedChannel" reply-channel="restOutputChannel"
uri="http://localhost:8088/mockSoapBinding" marshaller="marshaller"
message-sender="messageSender"
unmarshaller="marshaller" >
</int-ws:outbound-gateway>
But some informations which are in the REST request need to put to the SAOP envelope header and not the envelope body. Eg.
REST Request:
{
"foo": "foo",
"bar": "bar"
}
And SOAP Request sould be:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header>
<foo>foo</foo>
</soapenv:Header>
<soapenv:Body>
<bar>bar</bar>
</soapenv:Body>
</soapenv:Envelope>
How can I do that? The transformer only create the soap body, and the in an interceptor or header mapper I don't have the original request anymore. Is there any way to do that?
See the documentation.
WS Message Headers
The Spring Integration WebService Gateways will map the SOAP Action header automatically. It will be copied by default to and from Spring Integration MessageHeaders using the DefaultSoapHeaderMapper.
Of course, you can pass in your own implementation of SOAP specific header mappers, as the gateways have respective properties to support that.
Any user-defined SOAP headers will NOT be copied to or from a SOAP Message, unless explicitly specified by the requestHeaderNames and/or replyHeaderNames properties of the DefaultSoapHeaderMapper.
...

Salesforce Outgoing message: SOAP response was a nack

I am integrating with an in-house system. I have set up an outgoing message on one object and my web service is seeing the message every time I update a record. My service is sending an true response, but the outgoing message delivery status is showing "SOAP response was a nack".
I have used wireshark to capture the request and the response on my web server. This is what I see:
Request:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<notifications xmlns="http://soap.sforce.com/2005/09/outbound">
<OrganizationId>00D00000000hfNqEAI</OrganizationId>
<ActionId>04k370000004FsYAAU</ActionId>
<SessionId xsi:nil="true"/>
<EnterpriseUrl>https://na31.salesforce.com/services/Soap/c/36.0/00D00000000hfNq</EnterpriseUrl>
<PartnerUrl>https://na31.salesforce.com/services/Soap/u/36.0/00D00000000hfNq</PartnerUrl>
<Notification>
<Id>04l370000006ISGAA2</Id>
<sObject xsi:type="sf:Opportunity" xmlns:sf="urn:sobject.enterprise.soap.sforce.com">
<sf:Id>00637000007h5uwAAA</sf:Id>
<sf:AccountId>00100000003Qy45AAC</sf:AccountId>
<sf:Name>Andrew Test</sf:Name>
<sf:OwnerId>00500000006pE7kAAE</sf:OwnerId>
<sf:StageName>Unqualified</sf:StageName>
</sObject>
</Notification>
</notifications>
</soapenv:Body>
</soapenv:Envelope>
Response: (HTTP/1.1 200 OK)
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-NV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://soap.sforce.com/2005/09/outbound"><SOAP-ENV:Body><Ack>true</Ack></SOAP-ENV:Body></SOAP-ENV:Envelope>
Can anyone see what is causing the response to fail?
Your response message doesn't conform to the format described by the WSDL, it should be
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<notificationsResponse xmlns="http://soap.sforce.com/2005/09/outbound">
<Ack>true</Ack>
</notificationsResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
note the additional notificationsResponse element, and the fact that this is in the OM xml namespace.

weblogic Ws-security policy vs oasis policy

We are trying to configure ws-security on a webservice deployed on Weblogic 10.3.6: the purpose is to permit the execution of the ws only if authenticated.
So, we created an user ("dummy") into the default weblogic realm and communicated the credentials to who develops the client of this webservice.
He has released a test Envelope running by SOAP-UI
<soapenv:Envelope xmlns:sch="http://com.webservices.amm.standalone.key.provider/schema.xsd" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header>
<wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:UsernameToken wsu:Id="UsernameToken-2">
<wsse:Username>dummy</wsse:Username>
<wsse:Password Type="**http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest**"><!-- digested password --></wsse:Password>
<wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary"><!-- encoding type --></wsse:Nonce>
<wsu:Created>2015-06-24T14:42:48.749Z</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
<sch:searchKeyReq>
<sch:KeyProviderInput>
<!--Here input attributes:-->
</sch:KeyProviderInput>
</sch:searchKeyReq>
</soapenv:Body>
</soapenv:Envelope>
which response is
<?xml version='1.0' encoding='UTF-8'?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body><SOAP-ENV:Fault xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<faultcode xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">**SOAP-ENV:MustUnderstand**</faultcode>
<faultstring>MustUnderstand headers:[{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}Security] are not understood</faultstring>
</SOAP-ENV:Fault></S:Body></S:Envelope>
Obviously, I think, it depends by no configuration on ws-policy of the webservice.
So the questions are:
1) which is the policy we must associate to our webservice by Administration Console or by weblogic #Policy annotation in correspondence of oasis policy we see into the soapenv:Header tag>?
2) the "dummy" user must have some specific role?
Thanks in advance
You can simply add below line to your web service class:
#Policy(uri = "Wssp1.2-2007-Https-UsernameToken-Plain.xml", attachToWsdl=true)
By means of this policy you tell the clients that send their username and password (plain text). There are some other policy that you can choose in order to send encrypted password such as Digest.
You can choose this policy also from weblogic console.
And about role of the user, according to my knowledge, defining a new user in security realm just works really well, but in order to manage roles and permissions there should be some roles.

exploring the use of topic and event in Wso2 ESB

I’m exploring the use of topics and events in WSO2 ESB 4.8.1, I created a topic and subscribed to it the endpoint of one dataservice running in WSO2 WSAS(A), I supposed that if I published a message with the structure defined for the incoming message of one of A operations in the publish tool of the Topic Details console, the message would be sent to the supscriptor (A) and everything where going to work fine, but it don’t. Why?
I also create a proxy service with an event mediator and configured the event mediator with the name of the created topic. Then I Try the proxy service with an incoming message with the same structure explained before. I was expecting to at least get an incoming message in the WSAS Soap Tracer, but nothing happened.
Am I missing something?
The eventing infrastructure is based upon the WS-Eventing specification. Since you are using a WSDL based service as a subscriber of the topic and intend to invoke a specific operation of that service, I imagine it is failing because the SOAP message and/or SOAP action are incorrect because the message sent to the topic and the service are based around WS-Eventing and not your service.
I created the simple proxy below and subscribed it to a topic.
<proxy xmlns="http://ws.apache.org/ns/synapse" name="LogSubMessage" transports="http" statistics="disable" trace="disable" startOnLoad="true">
<target>
<inSequence>
<log level="full" category="ERROR">
<property name="SERVICE" value="LogSubMessage"/>
</log>
</inSequence>
<outSequence><send/></outSequence>
</target>
</proxy>
I then sent a <test/> message to the topic.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header>
<ns:topic xmlns:ns="http://wso2.org/ns/2009/09/eventing/notify">topicname</ns:topic>
</soapenv:Header>
<soapenv:Body>
<test/>
</soapenv:Body>
</soapenv:Envelope>
As you can see in the message above, the message logged in the service contains WS-Eventing SOAP headers and the SOAP action was set to http://ws.apache.org/ws/2007/05/eventing-extended/Publish . If your data service requires that the SOAP header contain the name of the operation to invoke, then it would reject this request.
I would suggest creating a proxy service, similar to the the one above, that would subscribe to the topic. This service would set the correct SOAP action, perform any message transformations you need, and call your data service.

Resources