I am making web service calls using PERL to one of our vendor provided web services. The web services use SOAP 1.2 and WSHttpBinding.
I am able to make calls successfully to most of the calls in the web service, except for the RetrieveReport call. The RetrieveReport call is supposed to stream a file. However I am getting the response below.
An example to call the RetrieveReport was provided using C# code mentioning to use the following binding. However I have no clue how to do this in PERL. If anyone can provide any assistance, I thank you in advance.
C# App Config Binding
<binding name="WSHttpBinding_IBIStreamService" closeTimeout="00:02:00"
openTimeout="00:02:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="None">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true" />
</security>
</binding>
PERL Code
my $reportKey = 'report_key';
my $reportUri = 'report_uri';
my $xml = new XML::Simple;
my $userAgent = LWP::UserAgent->new(agent => 'https://service.com/services/BIDataService');
my $message = <<'.';
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
<s:Header>
<a:Action s:mustUnderstand="1">http://service.com/dataservices/bistream/2/IBIStreamService/RetrieveReport</a:Action>
<h:ReportKey xmlns:h="http://service.com/dataservices/bistream/2" xmlns="http://service.com/dataservices/bistream/2">[ReportKey]</h:ReportKey>
<a:To s:mustUnderstand="1">[ReportRetrievalUri]</a:To>
</s:Header>
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<RetrieveReportRequest xmlns="http://service.com/dataservices/bistream/2" />
</s:Body>
</s:Envelope>
.
# Replace the dynamic values
$message =~ s/\[ReportKey\]/$reportKey/g;
$message =~ s/\[ReportRetrievalUri\]/$reportUri/g;
my $request = HTTP::Request->new(POST => $uri);
$request->header(SOAPAction => '"http://service.com/dataservices/bistream/2/IBIStreamService/RetrieveReport"');
$request->content($message);
$request->content_type("application/soap+xml; charset=utf-8");
print "-- CONTENT --\n\n";
print $request->content . "\n\n";
my $response = $userAgent->request($request);
if ($response->is_success) {
print "--SUCCESS--\n" . $response->decoded_content . "\n";
} else {
print "--FAILURE--\n" . $response->status_line, "\n";
print $response->error_as_HTML;
}
Response From Vendor
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
<s:Header>
<a:Action s:mustUnderstand="1">http://www.w3.org/2005/08/addressing/fault</a:Action>
</s:Header>
<s:Body>
<s:Fault>
<s:Code>
<s:Value>s:Sender</s:Value>
<s:Subcode>
<s:Value>a:ActionNotSupported</s:Value>
</s:Subcode>
</s:Code>
<s:Reason>
<s:Text xml:lang="en-US">The message with Action \'http://service.com/dataservices/bistream/2/IBIStreamService/RetrieveReport\' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).</s:Text>
</s:Reason>
</s:Fault>
</s:Body>
</s:Envelope>
WSDL Source
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions name="BIStreamService" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:tns="http://tempuri.org/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:i0="http://service.com/dataservices/bistream/2" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata">
<wsp:Policy wsu:Id="WSHttpBinding_IBIStreamService_policy">
<wsp:ExactlyOne>
<wsp:All>
<wsaw:UsingAddressing/>
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
<wsdl:import namespace="http://service.com/dataservices/bistream/2" location="https://service.com/services/BIStreamingService?wsdl=wsdl0"/>
<wsdl:types/>
<wsdl:binding name="WSHttpBinding_IBIStreamService" type="i0:IBIStreamService">
<wsp:PolicyReference URI="#WSHttpBinding_IBIStreamService_policy"/>
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="RetrieveReport">
<soap12:operation soapAction="http://service.com/dataservices/bistream/2/IBIStreamService/RetrieveReport" style="document"/>
<wsdl:input name="RetrieveReportRequest">
<soap12:header message="i0:RetrieveReportRequest_Headers" part="ReportKey" use="literal"/>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output name="StreamReportResponse">
<soap12:header message="i0:StreamReportResponse_Headers" part="Status" use="literal"/>
<soap12:header message="i0:StreamReportResponse_Headers" part="StatusMessage" use="literal"/>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="BasicHttpBinding_IBIStreamService" type="i0:IBIStreamService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="RetrieveReport">
<soap:operation soapAction="http://service.com/dataservices/bistream/2/IBIStreamService/RetrieveReport" style="document"/>
<wsdl:input name="RetrieveReportRequest">
<soap:header message="i0:RetrieveReportRequest_Headers" part="ReportKey" use="literal"/>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="StreamReportResponse">
<soap:header message="i0:StreamReportResponse_Headers" part="Status" use="literal"/>
<soap:header message="i0:StreamReportResponse_Headers" part="StatusMessage" use="literal"/>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="BIStreamService">
<wsdl:port name="WSHttpBinding_IBIStreamService" binding="tns:WSHttpBinding_IBIStreamService">
<soap12:address location="https://service.com/services/BIStreamingService"/>
<wsa10:EndpointReference>
<wsa10:Address>https://service.com/services/BIStreamingService</wsa10:Address>
</wsa10:EndpointReference>
</wsdl:port>
<wsdl:port name="BasicHttpBinding_IBIStreamService" binding="tns:BasicHttpBinding_IBIStreamService">
<soap:address location="https://service.com/services/BIStreamingService"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
I found out the issue.
There are two URLs for the report web service. One to execute the report and a different one to retrieve the report. I modified the LWP::UserAgent->new(agent => '') and the HTTP::Request->new(POST => '') to both point to https://service.com/services/BIStreamingService when retrieving the report and now it works.
Thank you!
Related
I have created SOAP service in NetBeans 13 that starts on GlassFish server with minor warnings:
Tue Jan 31 16:54:05 EET 2023 : Security manager installed using the Basic server security policy.
WARNING: A terminally deprecated method in java.lang.System has been called
WARNING: System::setSecurityManager has been called by org.apache.derby.drda.NetworkServerControl (file:/C:/java_test/AppServer/Glassfish/javadb/lib/derbynet.jar)
WARNING: Please consider reporting this to the maintainers of org.apache.derby.drda.NetworkServerControl
WARNING: System::setSecurityManager will be removed in a future release
Tue Jan 31 16:54:05 EET 2023 : Apache Derby Network Server - 10.15.2.0 - (1873585) started and ready to accept connections on port 1527
Service code:
package javaeetutorial.helloservice;
import javax.jws.WebService;
import javax.jws.WebMethod;
#WebService
public class Hello {
private final String message = "Hello, ";
public Hello() {
}
#WebMethod
public String sayHello(String name) {
return message + name + ".";
}
#WebMethod
public String sayHello2(String name) {
return message + name + ".";
}
}
I found WSDL file of this project in location \helloservice-war\target\generated-sources\wsdl\HelloService.wsdl
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Generated by JAX-WS RI (https://github.com/eclipse-ee4j/metro-jax-ws). RI's version is JAX-WS RI 2.3.3 git-revision#b4c5bb6. -->
<definitions targetNamespace="http://helloservice.javaeetutorial/" name="HelloService" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:tns="http://helloservice.javaeetutorial/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata">
<types>
<xsd:schema>
<xsd:import namespace="http://helloservice.javaeetutorial/" schemaLocation="HelloService_schema1.xsd"/>
</xsd:schema>
</types>
<message name="sayHello2">
<part name="parameters" element="tns:sayHello2"/>
</message>
<message name="sayHello2Response">
<part name="parameters" element="tns:sayHello2Response"/>
</message>
<message name="sayHello">
<part name="parameters" element="tns:sayHello"/>
</message>
<message name="sayHelloResponse">
<part name="parameters" element="tns:sayHelloResponse"/>
</message>
<portType name="Hello">
<operation name="sayHello2">
<input wsam:Action="http://helloservice.javaeetutorial/Hello/sayHello2Request" message="tns:sayHello2"/>
<output wsam:Action="http://helloservice.javaeetutorial/Hello/sayHello2Response" message="tns:sayHello2Response"/>
</operation>
<operation name="sayHello">
<input wsam:Action="http://helloservice.javaeetutorial/Hello/sayHelloRequest" message="tns:sayHello"/>
<output wsam:Action="http://helloservice.javaeetutorial/Hello/sayHelloResponse" message="tns:sayHelloResponse"/>
</operation>
</portType>
<binding name="HelloPortBinding" type="tns:Hello">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name="sayHello2">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
<operation name="sayHello">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="HelloService">
<port name="HelloPort" binding="tns:HelloPortBinding">
<soap:address location="REPLACE_WITH_ACTUAL_URL"/>
</port>
</service>
</definitions>
When I run project from IDE it opens browser on adrees http://localhost:8080/helloservice-war/HelloService?Tester . Browser window shows error 404-Not found
I feed WSDL to SOAPUI client and have changed service path REPLACE_WITH_ACTUAL_URL to http://localhost:8080/helloservice-war/HelloService . I called function sayHello, but got 404 error.
Where is my service located and how to call it's functions?
GlassFish console:
I'm trying to use the function "createClassFromWsdl" with matlab and it gives me a error :
createClassFromWsdl('http://localhost/soapserver/server.php?WSDL')
Retrieving document at 'http://localhost/soapserver/server.php?WSDL'
Struct contents reference from a non-struct array object.
Error in createClassFromWsdl>parseWsdl (line 74)
se = defTypes.getExtensibilityElements().get(0);
Error in createClassFromWsdl (line 34)
[R, schema] = parseWsdl(wsdlUrl);
I have download a software called SOAPUI which works perfectly well so I can't found what is wrong...
Here is my simple wsdl file :
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:tns="http://localhost/soapserver" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" targetNamespace="http://localhost/soapserver">
<wsdl:message name="printtxtSoapIn">
<wsdl:part name="txt" type="s:string"/>
</wsdl:message>
<wsdl:message name="printtxtSoapOut">
<wsdl:part name="return" type="s:string"/>
</wsdl:message>
<wsdl:portType name="SoapDemoSoap">
<wsdl:operation name="printtxt">
<wsdl:input message="tns:printtxtSoapIn"/>
<wsdl:output message="tns:printtxtSoapOut"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="SoapDemoSoap" type="tns:SoapDemoSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc"/>
<wsdl:operation name="printtxt">
<soap:operation soapAction="http://localhost/soapserver/printtxt"/>
<wsdl:input>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost/soapserver" parts="txt"/>
</wsdl:input>
<wsdl:output>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost/soapserver" parts="return"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="SoapDemo">
<wsdl:port name="SoapDemoSoap" binding="tns:SoapDemoSoap">
<soap:address location="http://localhost/soapserver/server.php"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
I am new to web services, I bought a book and started to learn from it, the WSDL is :
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://ttdev.com/ss" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="SimpleService" targetNamespace="http://ttdev.com/ss">
<wsdl:types>
<xsd:schema targetNamespace="http://ttdev.com/ss">
<xsd:element name="concatRequest">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="s1" type="xsd:string" />
<xsd:element name="s2" type="xsd:string"></xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="concatResponse" type="xsd:string">
</xsd:element>
</xsd:schema>
</wsdl:types>
<wsdl:message name="concatRequest">
<wsdl:part element="tns:concatRequest" name="parameters"/>
</wsdl:message>
<wsdl:message name="concatResponse">
<wsdl:part element="tns:concatResponse" name="parameters"/>
</wsdl:message>
<wsdl:portType name="SimpleService">
<wsdl:operation name="concat">
<wsdl:input message="tns:concatRequest"/>
<wsdl:output message="tns:concatResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="SimpleServiceSOAP" type="tns:SimpleService">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="concat">
<soap:operation soapAction="http://ttdev.com/ss/NewOperation"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="SimpleService">
<wsdl:port binding="tns:SimpleServiceSOAP" name="p1">
<soap:address location="http://localhost:8080/ss/p1"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
I run the SimpleService_P1_Server, it s working, but when I run the client :
SimpleService_P1_Client I got this exeption :
Apr 8, 2012 9:51:47 AM com.ttdev.ss.SimpleService_Service <clinit>
INFO: Can not initialize the default wsdl from src/main/resources/SimpleService.wsdl
Exception in thread "main" javax.xml.ws.WebServiceException: Port {http://ttdev.com/ss}p1 not found.
at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:328)
at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:319)
at javax.xml.ws.Service.getPort(Unknown Source)
at com.ttdev.ss.SimpleService_Service.getP1(SimpleService_Service.java:56)
at com.ttdev.ss.SimpleService_P1_Client.main(SimpleService_P1_Client.java:49)
Thanks, your help is appreciated.
I also faced similar issue some time back. You may want to use a prefix "file:" before "src/main/resources". Here is the resultant code:
WSDLToJava.main(new String[] { "-client", "-d", "src/main/java",
"file:src/main/resources/SimpleService.wsdl" });
I am trying to configure an existing SOAP web service in Mule using Mule Flows. I have an HTTP endpoint with request/response and a SOAP component, say Service A.
I want to configure this setup for a simple flow to work. I have set my HTTP endpoint and the SOAP service. The flow file is shown below.
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:cxf="http://www.mulesoft.org/schema/mule/cxf" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="CE-3.2.1" xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/cxf http://www.mulesoft.org/schema/mule/cxf/current/mule-cxf.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd ">
<flow name="demoflowFlow1" doc:name="demoflowFlow1">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" doc:name="HTTP"/>
<cxf:jaxws-service port="8082" serviceClass="com.myapp.serviceA.ServiceAImplService" doc:name="SOAP"/>
</flow>
</mule>
This is not working. My service is a simple one and it takes in a string and returns a string.
#WebService(targetNamespace = "http://service.demo.myapp.com/", endpointInterface = "com.myapp.demo.service.IServiceA", portName = "ServiceAImplPort", serviceName = "ServiceAImplService")
public class ServiceAImpl implements IServiceA {
public String hello(String user) {
return "at service A: " + user;
}
}
I am invoking my flow with the HTTP inbound URL http://localhost:8081/{I am not sure what goes here!} and getting:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>No such operation: (HTTP GET PATH_INFO: /)</faultstring>
</soap:Fault>
</soap:Body>
</soap:Envelope>
The Mule flow is running as an application in Mule Studio, and the service is running as a SOAP web service from Springsource toolsuite.
What am I doing wrong?
Original WSDL at http://localhost:8080/ServiceA/services/ServiceAImplPort?wsdl
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://service.demo.myapp.com/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="ServiceAImplService" targetNamespace="http://service.demo.myapp.com/">
<wsdl:types>
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://service.demo.myapp.com/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<import namespace="http://service.demo.myapp.com/" schemaLocation="http://localhost:8080/ServiceA/services/ServiceAImplPort?xsd=serviceaimpl_schema1.xsd"/>
</schema>
</wsdl:types>
<wsdl:message name="helloResponse">
<wsdl:part element="tns:helloResponse" name="parameters"></wsdl:part>
</wsdl:message>
<wsdl:message name="hello">
<wsdl:part element="tns:hello" name="parameters"></wsdl:part>
</wsdl:message>
<wsdl:portType name="IServiceA">
<wsdl:operation name="hello">
<wsdl:input message="tns:hello" name="hello"></wsdl:input>
<wsdl:output message="tns:helloResponse" name="helloResponse"></wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ServiceAImplServiceSoapBinding" type="tns:IServiceA">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="hello">
<soap:operation soapAction="urn:Hello" style="document"/>
<wsdl:input name="hello">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="helloResponse">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="ServiceAImplService">
<wsdl:port binding="tns:ServiceAImplServiceSoapBinding" name="ServiceAImplPort">
<soap:address location="http://localhost:8080/ServiceA/services/ServiceAImplPort"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
FYI, I can run the web service from SpringSource toolsuite without issues. Now, how do I invoke the web service from my HTTP inbound URL with a GET request?
[I presume simple web services like these take GET requests.]
I think you forgot the #WebMethod annotation at your method. This is basically what your error says: No operation.
Here is a very good example how you can do it.
#WebService(targetNamespace = "http://service.demo.myapp.com/", endpointInterface = "com.myapp.demo.service.IServiceA", portName = "ServiceAImplPort", serviceName = "ServiceAImplService")
public class ServiceAImpl implements IServiceA {
#WebMethod
#WebResult(name="result")
public String hello(#WebParam(name="user")String user) {
return "at service A: " + user;
}
}
It's very easy ... I guess com.myapp.serviceA.ServiceAImplService is your Service Implementation class and IServiceA.java is your Service class ... why don't you try this :-
There is something wrong in your wsdl.... Why < wsdl:service name="ServiceAImplService" > is ServiceAImplService ... instead it should be IServiceA .... ServiceAImplService is the web service implementation class I guess and should be kept in in mule flow
I've been experiencing some issues with the header presentation of a SOAP Request. I think I'm missing something.
My (partial) wsdl looks like this:
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:aws="http://xml.xxx.com"
xmlns:security_authenticate_6_1="http://xml.xxx.com/VLSSLQ_06_1_1A"
xmlns:security_authenticatereply_6_1="http://xml.xxx.com/VLSSLR_06_1_1A"
targetNamespace="http://xml.xxx.com">
<wsdl:types>
<xsd:schema targetNamespace="http://xml.xxx.com">
<xsd:import namespace="http://xml.xxx.com/ws/2009/01/WBS_Session-2.0.xsd" schemaLocation="WBS_Session-2.0.xsd"/>
<xsd:import namespace="http://xml.xxx.com/VLSSLQ_06_1_1A" schemaLocation="Security_Authenticate_06_1_1A.xsd"/>
<xsd:import namespace="http://xml.xxx.com/VLSSLR_06_1_1A" schemaLocation="Security_AuthenticateReply_06_1_1A.xsd"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="Session" xmlns:ns0="http://xml.xxx.com/ws/2009/01/WBS_Session-2.0.xsd">
<wsdl:part name="Session" element="ns0:Session"/>
</wsdl:message>
<wsdl:message name="Security_Authenticate_6_1">
<wsdl:part name="Security_Authenticate_6_1" element="security_authenticate_6_1:Security_Authenticate"/>
</wsdl:message>
<wsdl:message name="Security_AuthenticateReply_6_1">
<wsdl:part name="Security_AuthenticateReply_6_1" element="security_authenticatereply_6_1:Security_AuthenticateReply"/>
</wsdl:message>
<wsdl:portType name="XXXWebServicesPT">
<wsdl:operation name="Security_Authenticate">
<wsdl:input message="aws:Security_Authenticate_6_1"/>
<wsdl:output message="aws:Security_AuthenticateReply_6_1"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="XXXWebServicesBinding" type="aws:XXXWebServicesPT">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="Security_Authenticate">
<soap:operation soapAction="http://webservices.xxx.com/1ASIWJTUTUA/VLSSLQ_06_1_1A"/>
<wsdl:input>
<soap:header message="aws:Session" part="Session" use="literal"/>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:header message="aws:Session" part="Session" use="literal"/>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="XXXWebServices">
<wsdl:port name="XXXWebServicesPort" binding="aws:XXXWebServicesBinding">
<soap:address location="https://test.webservices.xxx.com"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
I want to access the Security_Authenticate action, in which case, the header must look something like:
<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'>
<soapenv:Header>
<wbs:Session xmlns:wbs='http://xml.xxx.com/ws/2009/01/WBS_Session-2.0.xsd'>
<wbs:SessionId></wbs:SessionId>
<wbs:SequenceNumber></wbs:SequenceNumber>
<wbs:SecurityToken></wbs:SecurityToken>
</wbs:Session>
</soapenv:Header>
<soapenv:Body>
<vls:Security_Authenticate>
<vls:tagX>
<vls:tagY>yyy</vls:tagY>
<vls:tagZ>Z</vls:tagZ>
</vls:tagX>
</vls:Security_Authenticate>
</soapenv:Body>
</soapenv:Envelope>
How should I built my soapenvelope and my header namespaces?
Thanks.
You have to declare the namespace before you use the object in the xsd, so in your case, to use the Session object:
<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'>
<soapenv:Header>
<wbs:Session xmlns:wbs='http://xml.xxx.com/ws/2009/01/WBS_Session-2.0.xsd'>
<wbs:SessionId></wbs:SessionId>
<wbs:SequenceNumber></wbs:SequenceNumber>
<wbs:SecurityToken></wbs:SecurityToken>
</wbs:Session>
</soapenv:Header>
...