I want to use JAX-WS API to create a WS-Addressing enabled web service client. I used wsimport to create the client stub from the WSDL file, and can enable/disable WS-Addressing by using the AddressingFeature, e.g.
Hello hello = service.getHelloSoap11(new AddressingFeature(true, true));
However, I cannot find any samples in web that customize the WS-Addressing ReplyTo/FaultTo endpoint reference. Basically I want to create a WS request like the following (see the wsa:ReplyTo element):
<soapenv:Envelope ...>
<soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
<wsa:To soapenv:mustUnderstand="1">http://localhost:8080/poc/helloService/
</wsa:To>
<wsa:ReplyTo>
<wsa:Address>http://mycompany.com/poc/reply</wsa:Address>
<wsa:ReferenceParameters>
<field1 xmlns="http://mycompany.com/poc/cust">some value1</field1>
<field2 xmlns="http://mycompany.com/poc/cust">some value2</field2>
</wsa:ReferenceParameters>
</wsa:ReplyTo>
<wsa:Action>http://mycompany.com/poc/sayHello</wsa:Action>
<wsa:MessageID>urn:uuid:7849b04f-c74e-4836-99e4-8e25d2700fae
</wsa:MessageID>
</soapenv:Header>
<soapenv:Body>
...
</soapenv:Body>
</soapenv:Envelope>
I can add endpoint reference if using Spring Web Service client. However, I need to do it using JAX-WS. Any ideas?
I answer my own question.
It seems that the standard JAX-WS API does not provide a convenient way to customize the WS-Addressing From/ReplyTo/FaultTo endpoint references. However, each JAX-WS runtime may provide additional proprietary API to set the headers.
For example, the IBM JAX-WS RI provides an EndpointReferenceManager SPI to create the endpoint reference:
import com.ibm.wsspi.wsaddressing.EndpointReference;
import com.ibm.wsspi.wsaddressing.EndpointReferenceManager;
import com.ibm.wsspi.wsaddressing.WSAConstants;
public void testWSAddressing () {
// get the port
Hello hello = service.getHelloSoap11();
// build a EndpiontReference of <wsa:ReplyTo>
BindingProvider bp = (BindingProvider) hello;
EndpointReference epr = EndpointReferenceManager.createEndpointReference(new URI(
"http://www.w3.org/2005/08/addressing/anonymous"));
epr.setReferenceParameter(new QName("http://mycompany.com/test", "someRefParam"),
"12345678");
((BindingProvider) hello).getRequestContext()
.put(WSAConstants.WSADDRESSING_REPLYTO_EPR, epr);
...
HelloResponse response = hello.hello(request);
}
The above code, when running inside IBM Websphere, will produce a SOAP message like the following:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
<wsa:To>http://localhost:8080/poc/helloService/</wsa:To>
<wsa:ReplyTo>
<wsa:Address>http://www.w3.org/2005/08/addressing/anonymous
</wsa:Address>
<wsa:ReferenceParameters>
<someRefParam xmlns="http://mycompany.com/test">12345678</someRefParam>
</wsa:ReferenceParameters>
</wsa:ReplyTo>
<wsa:MessageID>urn:uuid:BE9E173A35BAB51CB31338454394298
</wsa:MessageID>
<wsa:Action>http://mycompany.com/Hello</wsa:Action>
</soapenv:Header>
<soapenv:Body>
...
</soapenv:Body>
</soapenv:Envelope >
I've found a way to do this with standard JAX-WS.
When getting a port, use both AddressingFeature and OneWayFeature.
AddressingFeature addressingfeature = new AddressingFeature();
OneWayFeature onewayfeature = new OneWayFeature(true, new WSEndpointReference(YOUR_REPLY_TO_ADDRESS, AddressingVersion.W3C));
// get the port
Hello hello = service.getHelloSoap11(addressingfeature, onewayfeature);
This will produce messages with "ReplyTo" tag.
You may have to grab "com.sun.xml.ws:jaxws-rt" dependency for this.
Related
I'm invoking a web service that requires WS-Addressing SOAP headers. I'm using Apache Camel with CXF to invoke the web service. When I configure the CXF endpoint with the web service's WSDL, it's smart enough to automatically add WS-Adressing SOAP headers, but I need to set a custom MessageId.
Here is the message that is currently being sent:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Header>
<ws:international xmlns:ws="http://www.w3.org/2005/09/ws-i18n">
<ws:locale xmlns:ws="http://www.w3.org/2005/09/ws-i18n">en_CA</ws:locale>
</ws:international>
<fram:user wsa:IsReferenceParameter="true" xmlns:fram="http://wsbo.webservice.ephs.pdc.ibm.com/Framework/" xmlns:wsa="http://www.w3.org/2005/08/addressing">BESTSystem</fram:user>
<Action soap:mustUnderstand="true" xmlns="http://www.w3.org/2005/08/addressing">http://webservice.ephs.pdc.ibm.com/Client/QueryHumanSubjects</Action>
<MessageID soap:mustUnderstand="true" xmlns="http://www.w3.org/2005/08/addressing">urn:uuid:945cfd10-9fd2-48f9-80b4-ac1b9f3293c6</MessageID>
<To soap:mustUnderstand="true" xmlns="http://www.w3.org/2005/08/addressing">https://panweb5.panorama.gov.bc.ca:8081/ClientWebServicesWeb/ClientProvider</To>
<ReplyTo soap:mustUnderstand="true" xmlns="http://www.w3.org/2005/08/addressing">
<Address>http://www.w3.org/2005/08/addressing/anonymous</Address>
</ReplyTo>
</soap:Header>
<soap:Body>
<ns2:queryHumanSubjectsRequest xmlns:ns2="http://wsbo.webservice.ephs.pdc.ibm.com/Client/" xmlns:ns3="http://wsbo.webservice.ephs.pdc.ibm.com/FamilyHealth/">
<!-- stuff -->
</ns2:queryHumanSubjectsRequest>
</soap:Body>
</soap:Envelope>
As you can see, the MessageId value is "urn:uuid:945cfd10-9fd2-48f9-80b4-ac1b9f3293c6". I need to set a custom value.
I tried adding the MessageId header they way I add the other headers like "international" and "user", but some part of the framework overrides the value.
// Note this doesn't work! Something overrides the value. It works for other headers.
#Override
public void process(Exchange exchange) throws Exception {
Message in = exchange.getIn();
List<SoapHeader> headers = CastUtils.cast((List<?>) in.getHeader(Header.HEADER_LIST));
SOAPFactory sf = SOAPFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
QName MESSAGE_ID_HEADER = new QName("http://www.w3.org/2005/08/addressing", "MessageID", "wsa");
SOAPElement messageId = sf.createElement(MESSAGE_ID_HEADER);
messageId.setTextContent("customValue");
SoapHeader soapHeader = new SoapHeader(MESSAGE_ID_HEADER, messageId);
headers.add(soapHeader);
}
The CXF website has some documentation on how to set WS-Addressing headers, but I don't see how to apply it to Apache Camel. The Apache Camel CXF documentation doesn't specifically mention WS-Addressing either.
The documentation links you posted actually do have the information you need, although it's not immediately obvious how to apply it to Camel.
The CXF documentation says that:
The CXF org.apache.cxf.ws.addressing.impl.AddressingPropertiesImpl object can be used to control many aspects of WS-Addressing including the Reply-To:
AddressingProperties maps = new AddressingPropertiesImpl();
EndpointReferenceType ref = new EndpointReferenceType();
AttributedURIType add = new AttributedURIType();
add.setValue("http://localhost:9090/decoupled_endpoint");
ref.setAddress(add);
maps.setReplyTo(ref);
maps.setFaultTo(ref);
((BindingProvider)port).getRequestContext()
.put("javax.xml.ws.addressing.context", maps);
Note that it sets the addressing properties on the "RequestContext".
The Apache Camel documentation says that:
How to propagate a camel-cxf endpoint’s request and response context
CXF client API provides a way to invoke the operation with request and response context. If you are using a camel-cxf endpoint producer to invoke the outside web service, you can set the request context and get response context with the following code:
CxfExchange exchange = (CxfExchange)template.send(getJaxwsEndpointUri(), new Processor() {
public void process(final Exchange exchange) {
final List<String> params = new ArrayList<String>();
params.add(TEST_MESSAGE);
// Set the request context to the inMessage
Map<String, Object> requestContext = new HashMap<String, Object>();
requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, JAXWS_SERVER_ADDRESS);
exchange.getIn().setBody(params);
exchange.getIn().setHeader(Client.REQUEST_CONTEXT , requestContext);
exchange.getIn().setHeader(CxfConstants.OPERATION_NAME, GREET_ME_OPERATION);
}
});
The above example has some stuff we don't need, but the important thing is that it shows us how to set the CXF Request Context.
Put them together and you get:
#Override
public void process(Exchange exchange) throws Exception {
AttributedURIType messageIDAttr = new AttributedURIType();
messageIDAttr.setValue("customValue");
AddressingProperties maps = new AddressingProperties();
maps.setMessageID(messageIDAttr);
Map<String, Object> requestContext = new HashMap<>();
requestContext.put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES, maps);
exchange.getIn().setHeader(Client.REQUEST_CONTEXT, requestContext);
}
// org.apache.cxf.ws.addressing.JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES = "javax.xml.ws.addressing.context"
// org.apache.cxf.endpoint.Client.REQUEST_CONTEXT = "RequestContext"
Warning: In my route, I invoke multiple different web services sequentially. I discovered that after setting the RequestContext as shown above, Camel started using the same RequestContext for all web services, which resulted in an error: "A header representing a Message Addressing Property is not valid and the message cannot be processed". This is because the incorrect "Action" header was used for all web service invocations after the first.
I traced this back to Apache Camel using a "RequestContext" Exchange property, separate from the header we set, which apparently takes priority over the header. If I remove this property prior to calling subsequent web services, CXF automatically fills in the correct Action header.
if your problem not solved, I suggest you to combine your cxf service with custom interceptor. it easy to work with your soap message. like this:
<bean id="TAXWSS4JOutInterceptorBean" name="TAXWSS4JOutInterceptorBean" class="com.javainuse.beans.SetDetailAnswerInterceptor " />
<cxf:cxfEndpoint id="CXFTest" address="/javainuse/learn"
endpointName="a:SOATestEndpoint" serviceName="a:SOATestEndpointService"
serviceClass="com.javainuse.SOATestEndpoint"
xmlns:a ="http://javainuse.com">
<cxf:binding>
<soap:soapBinding mtomEnabled="false" version="1.2" />
</cxf:binding>
<cxf:features>
<wsa:addressing xmlns:wsa="http://cxf.apache.org/ws/addressing"/>
</cxf:features>
<cxf:inInterceptors>
<ref bean="TAXWSS4JInInterceptorBean" />
</cxf:inInterceptors>
<cxf:inFaultInterceptors>
</cxf:inFaultInterceptors>
<cxf:outInterceptors>
<ref bean="TAXWSS4JOutInterceptorBean" />
</cxf:outInterceptors>
<cxf:outFaultInterceptors>
</cxf:outFaultInterceptors>
</cxf:cxfEndpoint>
and in the interceptor you can set soap headers like this:
public class SetDetailAnswerInterceptor extends WSS4JOutInterceptor {
public SetDetailAnswerInterceptor() {
}
#Override
public void handleMessage(SoapMessage mc) {
AttributedURIType value = new AttributedURIType();
value.setValue("test");
((AddressingProperties) mc.get("javax.xml.ws.addressing.context.outbound")).setMessageID(value);
}
}
I'm trying to send a SOAP Request to a webservice in Delphi XE5. Actually there is a WSDL available which I imported via WSDL Importer. I established a connection to this webservice with the components THTTPRIO (rio) and IdEncoderMIME1 for the HTTP Authentication Request.
The SOAP Request was build via TXMLDocument and has the following structure:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cod=NS_Codelist>
<soapenv:Header/>
<soapenv:Body>
<cod:GetLatestChangeDatesRequest>
<!--Zero or more repetitions:-->
<CodeListID>1035</CodeListID>
</cod:GetLatestChangeDatesRequest>
</soapenv:Body>
</soapenv:Envelope>
Furthermore I received the Porttype of the webservice.
codeserv:= GetCodeListPortType(true,'',rio);
These are methods from the WSDL:
codeserv.GetLatestChangeDates(const body:GetLatestChangeDatesRequestType):GetLatestChangeDatesResponseType
GetLatestChangeDatesRequestType = array of Int64;
GetLatestChangeDatesRequest = GetLatestChangeDatesRequestType;
GetLatestChangeDatesResponseType = array of CodeListLatestChangeDateType;
GetLatestChangeDatesResponse = GetLatestChangeDatesResponseType;
CodeListLatestChangeDateType
property CodeListID: Int64
property LatestChangeDate: TXSDate
I have already tried to set an array of Int64 for the parameter but then it says "element CodeListID is missing".
Unfortunately I don't find a way to send this XML SOAP Request to the webservice and to receive the response. Any ideas?
EDIT: I have tried to use the WSDL methods
var
codeserv: CodeListPortType;
arrIDs: GetLatestChangeDatesRequest;
response: GetLatestChangeDatesResponse;
begin
codeserv:= GetCodeListPortType(true,'',rio);
SetLength(arrIDs,1);
arrIDs[0]:= 1035;
response:= codeserv.GetLatestChangeDates(arrIDs);
But then I receive the following error message: 'invalid content was found starting with element 'long'. One of '{CodeListID}' is expected.'
In the SOAP Request there have to be the element CodeListID. Unfortunately it seems the method GetLatestChangeDates isn't creating the elements in the SOAP Request. The SOAP Request posted above should have been created with this method (hopefully).
Can some explain the best way on SOAP UI Free to achieve the below scenario
Load the response value from one Test Case Web service as a request value on second Test Case Web service.
in Test case 1 Script Assertion
import com.eviware.soapui.support.XmlHolder
def respXmlHolder = new XmlHolder(messageExchange.getResponseContentAsXml())
respXmlHolder.declareNamespace("ns1","http://www.moj.com/api/services/checkout")
def finsess = respXmlHolder.getNodeValue("//ns1:sessresp/ns1:sessionId")
log.info finsess
Log Info shows below 70c8a6f80b6ff0c72502
Now how to automatically load this above sessionid onto Test Case 2 Web Service as shown below.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://www.moj.com/api/services/final">
<soapenv:Header/>
<soapenv:Body>
<typ:FinSessionRequest>
<typ:correlationId>1234</typ:correlationId>
<typ:sessionId>70c8a6f80b6ff0c72502</typ:sessionId>
<typ:username>abcd</typ:username>
<typ:password>1234</typ:password>
</typ:FinSessionRequest>
</soapenv:Body>
</soapenv:Envelope>
You can use Property transfer test step for this task, without Groovy scripting. See more at SoapUI docs. You just pick the source XML element with XPath and similarly the target element. SoapUI will do the replacement when you execute the test step (or the test case). I recommend to use this way as it is transparent.
If you really need to transfer the value with Groovy scripting, you can set a test suite property value in your assertion script:
def testSuite = context.getTestCase().getTestSuite()
testSuite.setPropertyValue("MyId", finsess)
And then place the MyId into your request message:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://www.moj.com/api/services/final">
<soapenv:Header/>
<soapenv:Body>
<typ:FinSessionRequest>
<typ:correlationId>1234</typ:correlationId>
<typ:sessionId>${#TestSuite#MyId}</typ:sessionId>
<typ:username>abcd</typ:username>
<typ:password>1234</typ:password>
</typ:FinSessionRequest>
</soapenv:Body>
</soapenv:Envelope>
This works as long as the two test cases belong to the same test suite.
Karel
I am trying to consume SOAP (external system) web service using Spring WS template as client.
I need to pass header information(security details) as header along with the soap message.
I tried adding that information into Header using java xml SOAPMessage(javax.xml.soap.SoapMessage) and trying to convert it into spring SOAPMessage(org.springframework.ws.soap.SoapMessage) later after adding header details.
but its not able to cast it, getting class cast exception as both of them are not in heirarchy.
please help me on how to pass security details on header info in spring soap message
My code is as below
public void doWithMessage(WebServiceMessage message) throws IOException,
TransformerException
SaajSoapMessage saajSoapMessage =(SaajSoapMessage)message;
SOAPMessage soapMessage = saajSoapMessage.getSaajMessage();
SOAPPart soapPart = soapMessage.getSOAPPart();
SOAPEnvelope soapEnvelope = soapPart.getEnvelope();
SOAPHeader soapHeader = soapEnvelope.getHeader();
Name headerElementName = soapEnvelope.createName("Security","wsse","http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd");
// Add "Security" soapHeaderElement to soapHeader
SOAPHeaderElement soapHeaderElement = soapHeader.addHeaderElement(headerElementName);
// This may be important for some portals!
soapHeaderElement.setActor(null);
// Add usernameToken to "Security" soapHeaderElement
SOAPElement usernameTokenSOAPElement = soapHeaderElement.addChildElement("UsernameToken");
// Add username to usernameToken
SOAPElement userNameSOAPElement = usernameTokenSOAPElement.addChildElement("Username");
userNameSOAPElement.addTextNode("myUserName");
// Add password to usernameToken
SOAPElement passwordSOAPElement = usernameTokenSOAPElement.addChildElement("Password");
passwordSOAPElement.addTextNode("myPassword");
((SoapMessage) soapMessage).setSoapAction("GetMetaDataLookUpRequestType");//exception while casting
}
And my request xml is as below
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="http://emc.com/it/enterprise/contract/CMCContractLookupService/v1" xmlns:v11="http://emc.com/it/enterprise/data/v1">
<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-20">
<wsse:Username>xxxx</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">xxxx</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
<v1:GetContractMetaDataLookUpRequest>
<v11:GetMetaDataLookUpRequestDocument>
<v11:ContractID>123456</v11:ContractID>
<v11:BadgeID>1</v11:BadgeID>
</v11:GetMetaDataLookUpRequestDocument>
</v1:GetContractMetaDataLookUpRequest>
</soapenv:Body>
</soapenv:Envelope>
I need help mainly on how can i add that header info(as shown in above xml request) into soap header message.
help is greatly appreciated. thank you.
This should be saajSoapMessage.setSoapAction("GetMetaDataLookUpRequestType") instead of ((SoapMessage)soapMessage).setSoapAction("GetMetaDataLookUpRequestType").
We connect with multiple (20-30) third-party web services within our C# Batch Application. We are attempting to find the best way to call these web services dynamically (without generating proxy or using wsdl). All the third party agencies endpoints or URL's will be configured in database table. Client app will check the URL at run-time and make a service call. We are not worried about async calls it’s all synchronized process.
SQL Table : Client-configuration
Client URL Method IsActive
A http://serverhost/ClientA/Service1.svc Submit 1
B http://serverhost/ClientB/Service2.asmx Submit 1
The only issue is we are not sure about the third party service implementation is WCF or asmx. I have read few articles online to use HttpWebRequest to call web services dynamically (without generating proxies/wsdl.)
Is this the best way to implement this or any concerns I need to think of?
Please see below ex:
public static void CallWebService(string xml)
{
var _Url = "http://serverhost/ClientA/Service1.svc";
var _action = "http://serverhost/ClientA/Service1.svc/Submit";
try
{
ASCIIEncoding encoder = new ASCIIEncoding();
byte[] data = encoder.GetBytes(xml);
XmlDocument soapEnvelopeXml = CreateSoapEnvelope(xml);
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(_Url);
webRequest.Headers.Add("SOAPAction", _action);
webRequest.ContentType = "text/xml;charset=\"utf-8\"";
webRequest.ContentLength = data.Length;
webRequest.Accept = "text/xml";
webRequest.Method = "POST";
Stream webStream = webRequest.GetRequestStream();
webStream.Write(data, 0, data.Length);
webStream.Close();
WebResponse response = webRequest.GetResponse();
Stream responseStream = response.GetResponseStream();
using (StreamReader sr = new StreamReader(responseStream))
{
string s = sr.ReadToEnd();
}
}
catch (Exception ex)
{
responseStream = ex.Response.GetResponseStream();
}
}
Here is the details shared by one of the client.
http://setup.localhost.com/ClientA/Service1.asmx
Operation : Submit
SOAP 1.1
The following is a sample SOAP 1.1 request and response. The placeholders shown need to be
replaced with actual values.
POST /ClientA/Service1.asmx HTTP/1.1
Host: setup.localhost.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://setup.localhost.com/Submit"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<Submit xmlns="http://setup.localhost.com/">
<eCitXML>string</eCitXML>
<eCitPdf>base64Binary</eCitPdf>
<eCitKey>string</eCitKey>
</Submit>
</soap:Body>
</soap:Envelope>
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<SubmitResponse xmlns="http://setup.localhost.com/">
<SubmitResult>string</SubmitResult>
</SubmitResponse>
</soap:Body>
</soap:Envelope>
SOAP 1.2
The following is a sample SOAP 1.2 request and response. The placeholders shown need to be
replaced with actual values.
POST /ClientA/Service1.asmx HTTP/1.1
Host: setup.localhost.com
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-
envelope">
<soap12:Body>
<Submit xmlns="http://setup.localhost.com/">
<eCitXML>string</eCitXML>
<eCitPdf>base64Binary</eCitPdf>
<eCitKey>string</eCitKey>
</Submit>
</soap12:Body>
</soap12:Envelope>
HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-
envelope">
<soap12:Body>
<SubmitResponse xmlns="http://setup.localhost.com/">
<SubmitResult>string</SubmitResult>
</SubmitResponse>
</soap12:Body>
</soap12:Envelope>
I think your question could be rephrased as
Is there a generic method to call any SOAP 1.1 or 1.2 web service operation without prior knowledge of the service operation except for the SOAP action and URL?
I'm assuming that all the third party web services expose a common operation which accepts and returns the same types.
If this is the case then providing you model the service operation contract correctly you could use ChannelFactory to call all the services.
Calling WCF services is straightforward in this manner, but to call asmx services you'd need to do a bit more work. So your client code would need to know if the service was asmx or wcf, and moreover, if wcf, whether the service is soap 1.1 or 1.2.
I must say I'm struggling to understand what advantage you will have once you have achieved this. I can see the value if you owned all the 20+ services you were calling, but this clearly is not the case.
Granted, you won't have a ton of nasty generated service reference code, but the whole point of WSDL is it allows for machine generated service contracts. If the third party services make any breaking changes you'll need to manually synchronize these inside your client code, rather than just regenerating the client.