I need to write a SOAP request to a web service.
It is not working and I am narrowed it down to how I am defining the namespace in the .setRequestHeader "SoapAction" function or the actual SoapRequest string.
The request header requires the parameter [namespace]/[method] of the web service.
I have the web service code and in the .cs file the namespace is PagingService.
The wsdl for the service is:
http://<server>:<port>/PagingService/PagingService.Paging.svc?WSDL.
When I run a console application and access the vbscript, it returns the wsdl when I do a 'GET' and 'Send()' using the httpRequest object. So, I think this is fine.
I have to set the namespace with the method name in the setRequestHeader function:
httpRequest.setRequestHeader "SOAPAction", "PagingService/TestMethod"
Is this the correct way to set the namespace/method in the second parameter of this function?
If this is correct, my SoapRequest string must be wrong.
It requires the urn of the web service. How do I determine that?
To determine the SOAPAction of a web service method:
1. Open the WSDL
2. Find the method that you want to call
3. In my WSDL, the soap action was an attribute of the method.
It looked like this:
<wsdl:operation name="TestMethod">
<soap12:operation soapAction="http://tempuri.org/IPaging/TestMethod" style="document"/>
The namespace is http://tempuri.org/IPaging
The method is: TestMethod
Related
i've just installed the WSo2 service bus to make my own Service Oriented Architecture (SOA).
I'm trying to connect a Ignition (MES/SCADA) system, to a webservice on another (embedded)computer.
I've made the service in the management console, when i use the tryit function, i can fill in the form, but when i send the message i get the following error:
"The endpoint reference (EPR) for the Operation not found is /services/CalculatorWS.CalculatorWSHttpSoap12Endpoint and the WSA Action = null. If this EPR was previously reachable, please contact the server administrator."
When i try to do the same within my Ignition program, i get the following error: unknown url type:"calculatorws"?xsd=http.
I think this has to do with the SOAP message, because i compared the one from my webservice, with the one WSO2 generated.
WSO2 missgenerates the following line within the WSDL:
schemaLocation="CalculatorWS?xsd=http://169.254.166.123:8080/CalculatorApp/CalculatorWSService?xsd=1"
i think this should be:
schemaLocation="http://169.254.166.123:8080/CalculatorApp/CalculatorWSService?xsd=1"
is this the right conclusion? if yes, how can i adjust it?
besides this, when i use the SOAP Messagetracer from WSO2, i do get the answer i want back! how is this possible?
I'd like to hear from you,
Thanks in advance,
T Dantuma
According to your configuration, it looks like you are going to implement WSDL-based proxy. Then you no need to give published WSDL URL. Try to remove above line from proxy as you mentioned:
<xsd:import namespace="http://calculator.me.org/" schemaLocation="CalculatorWS?xsd=http://169.254.166.123:8080/CalculatorApp/CalculatorWSService?xsd=1"/>
ESB will be adding xsd with relevant namespace
when you define external namespace for given property
you adding external namespace for service within your service and ESB cannot identify your component. Then it will be use given namespace to solve confusions.
Try above methods. If you cannot identify exact error, please add whole configuration in your question (Edit and put the configuration).
If you still get the error:
Please log in to WSDL and check whether it can be accessible
http://169.254.166.123:8080/CalculatorApp/CalculatorWSService?wsdl
Check your invocation method. Becuase "POST" or "GET" request may need special invocations. (Ex: any parameters required for invocation or correct URL may different with exact method)
[1] https://docs.wso2.com/display/ESB490/WSDL+Based+Proxy+Template
I have a grails 2.3.x webapp that uses CXF to call to backend SOAP services. I'd like to set up a test where I call my service, but provide the response back from the service as a string directly to test it.
So, I want to set up a test that will autowire the service. I then set the response somehow as a string. Call the service method under test and under the covers it receives the response string I set and the request is ignored (or possibly even could check its validity). It parses the response which goes through the service code and returns as usual.
I don't want to have to run a separate server for the test. Is there someway to put in the response directly?
Hi I am trying to use Camel-SOAP component to create the soap message to invoke a .Net SOAP 1.2 service.
It is not working beacause the the SoapJaxbDataFormat is not putting the SOAP action, I am able to test and call the service using SOAPUI and I see in the request generated by SOAPUI that the soap header with action is filled in.
How can get action filled in ?
SoapJaxbDataFormat soapDF = new SoapJaxbDataFormat("xx.zzz.yy", new ServiceInterfaceStrategy(DpoService.class, true));
soapDF.setVersion("1.2");
soapDF.setNamespacePrefixRef(NAMESPACE_MAPPING_BEAN_NAME);
from("direct:quote")
.marshal(soapDF)
.log("${body}")
.setHeader(Exchange.HTTP_METHOD, constant("POST"))
.setHeader(Exchange.CONTENT_TYPE, constant("application/soap+xml;charset=UTF-8;action=\"http://example.com/services/DpoServiceContract/GetPof\""))
.to("http://localhost:7898/DpoService.svc");
The reason I am using this approach is because the CFX and WSImport generated client code does not work.
I was able to call the service using a velocity template to generate the SOAP msg.
Thank you for your help.
You can set the SOAP action from your message header, just like this:
exchange.getIn().setHeader(Exchange.SOAP_ACTION, "SOAPACTION");
I have to maintain a Java EE 5 web app.
A part of this app is the exchange of messages through web services (with WSDL contract).
The wsdl is used to generate the Java classes through the Eclipse wsdl2Java (I think it uses Axis)
Now I have to implement a modification where the server that we call via Web Service must be able to respond in an async way.
In fact the server will not respond immediately with the SOAP message response but, after a while, call a web service exposed by the client (our web app)
passing the SOAP Message response of the first call as a field (parameter) of this second Web service invocation.
The client then will save the SOAP response (or XML) in a file.
Is there a way to populate the already generated Java classes using this XML or SOAP message file? I mean a way to simulate the direct response of the server (feeding the Axis binding Stub)
I have also tried to use JAXB (to bind XML to JAVA) but since the SOAP message response is complex, when I call JAXBContext I receive an error:
CodPrestazione does not have a no-arg default constructor
since this class is an enum class generated by the wsdl2Java.
Is there a way to bypass this error without annotating or modifying the java class (this class is generated so I will be forced to modify this class at every re-generation)?
What is the best way to consume a saved SOAP message file(or XML)? Alternatively, how can I deserialize SOAP using Axis 1.3?
Can the format of the URL for an Axis2 web service be configured when using the code-first approach (where Axis2 is generating the URL)? In particular, we would like to leave the port name out of the URL.
We have a web service that was built with Axis2 using the code-first approach. That means the WSDL is generated from the Java classes and their annotations.
The web service URL is currently:
http://www.example.com/services/AvailabiltyService.AvailabilityServicePort
But we would like the URL to be shortened to:
http://www.example.com/services/AvailabiltyService
The <service> element of the generated WSDL currently looks like this:
<service name="AvailabilityService">
<port name="AvailabilityServicePort" binding="tns:AvailabilityServicePortBinding">
<soap:address location="http://www.example.com/services/AvailabilityService.AvailabilityServicePort/"/>
</port>
</service>
From what I understand, the URL is determined as follows:
The "/services/" portion is specified in the web.xml file. The pattern "/services/*" is specified in the web.xml file to route all requests matching that pattern to the AxisServlet.
The "AvailabiltyService" portion is the service name. It defaults to the value of the "name" parameter of the #WebService annotation with the word "Service" appended to it. This can be overridden by including a "serviceName" parameter on the #WebService annotation. In our case, we have included the "serviceName" parameter on the #WebService annotation with the value "AvailabilityService".
The "AvailabiltyServicePort" portion is the port name. It defaults to the service name with the word "Port" appended to it. This can be overridden by including a "portName" parameter on the #WebService annotation. In our case, we have not included the "portName" parameter on the #WebService annotation.
I realize we would have control over the URL if we used the contract-first approach, where we would write the WSDL ourselves, but we prefer to stay with the code-first approach.
Thank you for your time.