Spring-ws #Endpoint/#PayloadRoot based configuration giving 404 - java

Really stumped on this one - trying to utilize Spring-ws's #Endpoint and #PayloadRoot to automagically stand up some WSDL endpoints, but I keep getting a 404 (deploying into Tomcat 7.0.54). I've scoured this thing looking for naming inconsistencies (seems to be the most common cause of problems), but am finding nothing!
pom.xml:
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-core</artifactId>
<version>1.5.2</version>
</dependency>
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-core-tiger</artifactId>
<version>1.5.2</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.9</version>
</dependency>
<dependency>
<groupId>org.codehaus.castor</groupId>
<artifactId>castor</artifactId>
<version>1.2</version>
</dependency>
Web.xml:
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<servlet>
<servlet-name>weather</servlet-name>
<servlet-class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>weather</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
</web-app>
weather-servlet.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<bean id="weatherService" class="com.nick.example.weather.WeatherServiceImpl"/>
<bean class="org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping"/>
<bean id="temperatureEndpoint" class="com.nick.example.weather.TemperatureMarshallingEndpoint">
<property name="weatherService" ref="weatherService"/>
</bean>
<bean class="org.springframework.ws.server.endpoint.adapter.GenericMarshallingMethodEndpointAdapter">
<property name="marshaller" ref="marshaller"/>
<property name="unmarshaller" ref="marshaller"/>
</bean>
<bean id="marshaller" class="org.springframework.oxm.castor.CastorMarshaller">
<property name="mappingLocation" value="classpath:mapping.xml"/>
</bean>
<bean id="temperature" class="org.springframework.ws.wsdl.wsdl11.DynamicWsdl11Definition">
<property name="builder">
<bean class="org.springframework.ws.wsdl.wsdl11.builder.XsdBasedSoap11Wsdl4jDefinitionBuilder">
<property name="schema" value="/WEB-INF/temperature.xsd"/>
<property name="portTypeName" value="Weather"/>
<property name="locationUri" value="http://localhost:8080/weather/services"/>
</bean>
</property>
</bean>
</beans>
temperature.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema attributeFormDefault="unqualified"
elementFormDefault="qualified"
targetNamespace="http://nick.com/weather/schemas"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="GetTemperaturesRequest">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:string" name="city"/>
<xs:element type="xs:date" name="date" maxOccurs="5" minOccurs="1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="GetTemperaturesResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="TemperatureInfo" maxOccurs="5" minOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:float" name="min"/>
<xs:element type="xs:float" name="max"/>
<xs:element type="xs:float" name="average"/>
</xs:sequence>
<xs:attribute type="xs:string" name="city" use="optional"/>
<xs:attribute type="xs:date" name="date" use="optional"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
TemperatureMarshallingEndpoint.java:
package com.nick.example.weather;
import org.springframework.ws.server.endpoint.annotation.Endpoint;
import org.springframework.ws.server.endpoint.annotation.PayloadRoot;
import java.util.List;
#Endpoint
public class TemperatureMarshallingEndpoint {
private static final String namespaceUri = "http://nick.com/weather/schemas";
private WeatherService weatherService;
public void setWeatherService(WeatherService weatherService) {
this.weatherService = weatherService;
}
#PayloadRoot(
localPart = "GetTemperaturesRequest",
namespace = namespaceUri)
protected GetTemperaturesResponse getTemperature(GetTemperaturesRequest request) {
List<TemperatureInfo> temperatures = weatherService.getTemperatures(request.getCity(), request.getDates());
return new GetTemperaturesResponse(temperatures);
}
}
I'm deploying to Tomcat right off the root ("/") - no errors, deploys fine. Below is the resulting wsdl, but one interesting note is that I can hit it with any URL starting with http://localhost:8080 and ending with "/temperature.wsdl". i.e. http://localhost:8080/weather/services/temperature.wsdl nets me the same wsdl as http://localhost:8080/blah/blah/blah/temperature.wsdl
WSDL:
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:schema="http://nick.com/weather/schemas" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" targetNamespace="http://nick.com/weather/schemas">
<wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://nick.com/weather/schemas">
<xs:element name="GetTemperaturesRequest">
<xs:complexType>
<xs:sequence>
<xs:element name="city" type="xs:string"/>
<xs:element maxOccurs="5" minOccurs="1" name="date" type="xs:date"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="GetTemperaturesResponse">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="5" minOccurs="1" name="TemperatureInfo">
<xs:complexType>
<xs:sequence>
<xs:element name="min" type="xs:float"/>
<xs:element name="max" type="xs:float"/>
<xs:element name="average" type="xs:float"/>
</xs:sequence>
<xs:attribute name="city" type="xs:string" use="optional"/>
<xs:attribute name="date" type="xs:date" use="optional"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
</wsdl:types>
<wsdl:message name="GetTemperaturesRequest">
<wsdl:part element="schema:GetTemperaturesRequest" name="GetTemperaturesRequest"></wsdl:part>
</wsdl:message>
<wsdl:message name="GetTemperaturesResponse">
<wsdl:part element="schema:GetTemperaturesResponse" name="GetTemperaturesResponse"></wsdl:part>
</wsdl:message>
<wsdl:portType name="Weather">
<wsdl:operation name="GetTemperatures">
<wsdl:input message="schema:GetTemperaturesRequest" name="GetTemperaturesRequest"></wsdl:input>
<wsdl:output message="schema:GetTemperaturesResponse" name="GetTemperaturesResponse"></wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="WeatherBinding" type="schema:Weather">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="GetTemperatures">
<soap:operation soapAction=""/>
<wsdl:input name="GetTemperaturesRequest">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="GetTemperaturesResponse">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="WeatherService">
<wsdl:port binding="schema:WeatherBinding" name="WeatherPort">
<soap:address location="http://localhost:8080/weather/services"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
I am trying to setup a SoapUI test against these by pointing SoapUI to: http://localhost:8080/weather/services/temperature.wsdl
Which generates a correct-looking (I think) SOAP request:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sch="http://nick.com/weather/schemas">
<soapenv:Header/>
<soapenv:Body>
<sch:GetTemperaturesRequest>
<sch:city>Chicago</sch:city>
<!--1 to 5 repetitions:-->
<sch:date>2014-06-24</sch:date>
</sch:GetTemperaturesRequest>
</soapenv:Body>
</soapenv:Envelope>
But sending the request through gives me a 404 response:
HTTP/1.1 404 Not Found
Any insights on what I might be doing wrong? THANKS!

Wow, unbelievable - of all things, it was the access modifier on my "getTemperature()" method in TemperatureMarshallingEndpoint. It was "protected", but needed to be "public" (works like a charm after making the change!)

Related

XSD for use with Spring, can't get it to match WSDL

For the project I'm working on we need to create a SOAP web service (using Spring boot). The actual interface and message format is defined by a WSDL. The problem is that from what I understand from the documentation (e.g. https://www.baeldung.com/spring-boot-soap-web-service), I actually need an XSD (the WSDL will be generated from that).
Since there is only the WSDL, I tried to create the XSD myself for use in the application. Here I have run in to a couple of problems, the biggest problem being that the request messages it accepts aren't the ones that are accepted by the WSDL.
The WSDL accepts requests which simply are named payment where mine require paymentRequest as the name of the body element. This is probably something simple, but I can't find how to fix this…
Simplified wsdl:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://xxx.yyy.com"
xmlns:impl="http://xxx.yyy.com"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:types>
<schema targetNamespace="http://xxx.yyy.com" xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<complexType name="XxxTxnResponse">
<sequence>
<element name="resultCode" type="xsd:int"/>
</sequence>
</complexType>
<complexType name="XxxToken">
<sequence>
<element name="tokenId" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
<complexType name="PaymentTxnResponse">
<complexContent>
<extension base="impl:XxxTxnResponse">
<sequence>
<element name="transactionRef" type="xsd:int"/>
</sequence>
</extension>
</complexContent>
</complexType>
</schema>
</wsdl:types>
<wsdl:message name="paymentRequest">
<wsdl:part name="posId" type="xsd:string"/>
<wsdl:part name="amountCents" type="xsd:int"/>
<wsdl:part name="token" type="impl:XxxToken"/>
</wsdl:message>
<wsdl:message name="paymentResponse">
<wsdl:part name="paymentReturn" type="impl:PaymentTxnResponse"/>
</wsdl:message>
<wsdl:portType name="XxxTxnHost">
<wsdl:operation name="payment" parameterOrder="posId amountCents token">
<wsdl:input message="impl:paymentRequest" name="paymentRequest"/>
<wsdl:output message="impl:paymentResponse" name="paymentResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="XxxTxnHostSoapBinding" type="impl:XxxTxnHost">
<wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="payment">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="paymentRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://xxx.yyy.com" use="encoded"/>
</wsdl:input>
<wsdl:output name="paymentResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://xxx.yyy.com" use="encoded"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="XxxTxnHostService">
<wsdl:port binding="impl:XxxTxnHostSoapBinding" name="XxxTxnHost">
<wsdlsoap:address location="wp.wsdl"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Example request:
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xxx="http://xxx.yyy.com">
<soapenv:Header/>
<soapenv:Body>
<xxx:payment soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<posId xsi:type="xsd:string">?</posId>
<amountCents xsi:type="xsd:int">?</amountCents>
<token xsi:type="xxx:XxxToken">
<tokenId xsi:type="xsd:string">?</tokenId>
</token>
</xxx:payment>
</soapenv:Body>
</soapenv:Envelope>
My simplified xsd:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://xxx.yyy.com"
xmlns:tns="http://xxx.yyy.com">
<xs:import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<xs:complexType name="XxxTxnResponse">
<xs:sequence>
<xs:element name="resultCode" type="xs:int"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="XxxToken">
<xs:sequence>
<xs:element name="tokenId" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="PaymentTxnResponse">
<xs:complexContent>
<xs:extension base="tns:XxxTxnResponse">
<xs:sequence>
<xs:element name="transactionRef" type="xs:int"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="paymentRequest">
<xs:complexType>
<xs:sequence>
<xs:element name="posId" type="xs:string"/>
<xs:element name="amountCents" type="xs:int"/>
<xs:element name="token" type="tns:XxxToken"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="paymentResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="paymentReturn" type="tns:PaymentTxnResponse"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Generated wsdl:
<?xml version="1.0" encoding="UTF-8" standalone="no"?><wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:sch="http://xxx.yyy.com" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://xxx.yyy.com" targetNamespace="http://xxx.yyy.com">
<wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://xxx.yyy.com">
<xs:import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<xs:complexType name="XxxTxnResponse">
<xs:sequence>
<xs:element name="resultCode" type="xs:int"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="XxxToken">
<xs:sequence>
<xs:element name="tokenId" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="PaymentTxnResponse">
<xs:complexContent>
<xs:extension base="tns:XxxTxnResponse">
<xs:sequence>
<xs:element name="transactionRef" type="xs:int"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="paymentRequest">
<xs:complexType>
<xs:sequence>
<xs:element name="posId" type="xs:string"/>
<xs:element name="amountCents" type="xs:int"/>
<xs:element name="token" type="tns:XxxToken"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="paymentResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="paymentReturn" type="tns:PaymentTxnResponse"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
</wsdl:types>
<wsdl:message name="paymentResponse">
<wsdl:part element="tns:paymentResponse" name="paymentResponse">
</wsdl:part>
</wsdl:message>
<wsdl:message name="paymentRequest">
<wsdl:part element="tns:paymentRequest" name="paymentRequest">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="yyy">
<wsdl:operation name="payment">
<wsdl:input message="tns:paymentRequest" name="paymentRequest">
</wsdl:input>
<wsdl:output message="tns:paymentResponse" name="paymentResponse">
</wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="yyySoap11" type="tns:yyy">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="payment">
<soap:operation soapAction=""/>
<wsdl:input name="paymentRequest">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="paymentResponse">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="yyyService">
<wsdl:port binding="tns:yyySoap11" name="yyySoap11">
<soap:address location="http://localhost:8206/yyyservice/ws"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
There are a number of differences which I hope to solve in the end (no use of encoded is one), but the biggest problem is the fact that my wsdl requires paymentRequest in the request body, whereas the original message uses just payment. The response actually looked similar to what is expected.
I'm sure there something simple I have forgotten to do/specify, so hopefully one of you is able to point me in the right direction.
There is a difference in your bindings definitions. In the given wsdl there is specified that rpc/encoded is used while in your generated wsdl document/literal is used. Most likely you can set these settings before generating the wsdl.
If you alter the generated wsdl so it uses the prc/encoded the request looks like:
<SOAP-ENV:Body>
<m:payment xmlns:m="http://xxx.yyy.com">
<m:payment>
<posId xsi:type="xsd:string">String</posId>
<amountCents xsi:type="xsd:int">0</amountCents>
<token xsi:type="m:XxxToken">
<tokenId xsi:type="xsd:string">String</tokenId>
</token>
</m:payment>
</m:payment>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
see https://learn.microsoft.com/en-us/previous-versions/dotnet/articles/ms996486(v=msdn.10)?redirectedfrom=MSDN#understand_topic6
OK, after loads of trial and error, I managed to find a different solution with which I was able to consume the messages.
I didn't like my earlier attempt where I renamed paymentRequest to just payment since when looking at the wsdl, I saw all the “input” parts missing from the operations. This didn't feel good.
However, by simply specifying the type
<xs:complexType name="PaymentRequest">
<xs:sequence>
<xs:element name="posId" type="xs:string"/>
<xs:element name="amountCents" type="xs:int"/>
<xs:element name="token" type="tns:XxxToken"/>
</xs:sequence>
</xs:complexType>
and the element
<xs:element name="paymentRequest" type ="PaymentRequest">
separately, it worked, and now with the input parts showing properly again in the WSDL.
Digging around a little more, it follows the main issue is actually (fully) caused by the original WSDL using RPC/encoded instead of Document/Literal (as already suggested by #martijn in his answer). As it turns out RPC/encoded is actually deprecated (quite a number of years now…) and doesn't seem to be supported by Spring.
So unless someone knows how to get Spring to use RPC/encoded, I guess I need to go back to the company that is asking me to develop a server to communicate with their hardware and make them allow Document/literal responses (at least).

<soap:header/> block in not coming in soap response

I am writing a soap web service with apache-cxf. I am following code first approach. The issue is , i am not getting "soap:header" tag under in response.I have gone through other wsdl and java implementation classes and not able to find what needs to be added in wsdl or SEI to get soap:header block in response.Please let me know if any one can help me in this.I would share more details if required.
My webservice class looks like -
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.ParameterStyle;
import javax.jws.soap.SOAPBinding.Style;
import javax.jws.soap.SOAPBinding.Use;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.ws.RequestWrapper;
import javax.xml.ws.ResponseWrapper;
/**
* This class was generated by Apache CXF 3.1.11
* 2017-05-01T12:11:39.200+05:30
* Generated source version: 3.1.11
*
*/
#WebService(targetNamespace = "http://webservice.sample.com", name = "SampleWebService")
#XmlSeeAlso({ObjectFactory.class})
public interface SampleWebService {
#WebResult(name = "Response", targetNamespace = "" )
#RequestWrapper(localName = "requestWrapper", targetNamespace = "http://webservice.sample.com", className = "com.sample")
#WebMethod
#ResponseWrapper(localName = "responseWrapper", targetNamespace = "http://webservice.sample.com", className = "com.sample" )
public com.sample.Response requestWrapper(
#WebParam(name = "request", targetNamespace = "http://requests.webservice.sample.com")
com.sample.Request request
);
}
and wsdl -
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://webservice.sample.com" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns1="http://schemas.xmlsoap.org/soap/http" name="SampleWebServiceService" targetNamespace="http://webservice.sample.com">
<wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ns2="http://response.webservice.sample.com" xmlns:ns1="http://requests.webservice.sample.com" targetNamespace="http://webservice.sample.com" version="1.0">
<xs:import namespace="http://requests.webservice.sample.com"/>
<xs:import namespace="http://response.webservice.sample.com"/>
<xs:element name="requestWrapper" type="ns1:Create"/>
<xs:element name="responseWrapper" type="ns2:CreateConfirmation"/>
</xs:schema>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ns1="http://common.sample.com" targetNamespace="http://response.webservice.sample.com" version="1.0">
<xs:import namespace="http://common.sample.com"/>
<xs:complexType name="CreateConfirmation">
<xs:sequence>
<xs:element form="qualified" name="Response">
<xs:complexType>
<xs:sequence>
<xs:element form="qualified" name="ID" type="xs:string"/>
<xs:element form="qualified" maxOccurs="unbounded" minOccurs="0" name="Error" type="ns1:Error"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:schema>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://requests.webservice.sample.com" version="1.0">
<xs:complexType name="Create">
<xs:sequence>
<xs:element form="qualified" name="Request">
<xs:complexType>
<xs:sequence>
<xs:element form="qualified" name="Name" type="xs:string"/>
<xs:element form="qualified" name="CreationDate" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:schema>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://common.sample.com" version="1.0">
<xs:complexType name="Error">
<xs:sequence>
<xs:element name="ErrorCode" type="xs:string"/>
<xs:element name="ErrorMessage" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
</wsdl:types>
<wsdl:message name="requestWrapper">
<wsdl:part element="tns:requestWrapper" name="parameters"></wsdl:part>
</wsdl:message>
<wsdl:message name="responseWrapper">
<wsdl:part element="tns:responseWrapper" name="parameters"></wsdl:part>
</wsdl:message>
<wsdl:portType name="SampleWebService">
<wsdl:operation name="requestWrapper">
<wsdl:input message="tns:requestWrapper" name="requestWrapper"></wsdl:input>
<wsdl:output message="tns:responseWrapper" name="responseWrapper"></wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="SampleWebServiceServiceSoapBinding" type="tns:SampleWebService">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="requestWrapper">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="requestWrapper">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="responseWrapper">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="SampleWebServiceService">
<wsdl:port binding="tns:SampleWebServiceServiceSoapBinding" name="SampleWebService">
<wsdlsoap:address location="http://localhost:8181/cxf/SampleWebService"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Soap Request -
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://webservice.sample.com" xmlns:ord="http://requests.webservice.sample.com">
<soapenv:Header/>
<soapenv:Body>
<web:requestWrapper>
<ord:Request>
<ord:Name>Harry</ord:Name>
<ord:CreationDate>2015-09-09T12:45:00</ord:CreationDate>
</ord:Request>
</web:requestWrapper>
</soapenv:Body>
</soapenv:Envelope>
Expected Response -
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header/>
<soap:Body>
<ns2:responseWrapper xmlns:ns2="http://common.sample.com" xmlns="http://response.sample.com">
<ID>12345678910</ID>
</ns2:responseWrapper>
</soap:Body>
</soap:Envelope>
Actual Response -
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns2:responseWrapper xmlns:ns2="http://common.sample.com" xmlns="http://response.sample.com">
<ID>12345678910</ID>
</ns2:responseWrapper>
</soap:Body>
</soap:Envelope>
An empty header element is not required. If you want to add a header, add for example the method parameter
#WebParam(partName = "bankHeader", mode = WebParam.Mode.OUT, name = "bankRequestHeader", targetNamespace = "http://example.bank.skjolber.github.com/v1", header = true)
javax.xml.ws.Holder<BankRequestHeader> bankHeader
(The sample was generated by moving and input to output header in this sample.)

wsdl binding not found in wsdl file

I've got the following wsdl file:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://www.minfin.fgov.be/bbf/extern/myMinfin/" xmlns="http://www.minfin.fgov.be/bbf/extern/myMinfin" xmlns:pols="http://www.minfin.fgov.be/bbf/extern/myMinfin/policies"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:types>
<xsd:schema targetNamespace="http://www.minfin.fgov.be/bbf/extern/myMinfin/">
<xsd:import namespace="http://www.minfin.fgov.be/bbf/extern/myMinfin/policies" schemaLocation="getPolicies.xsd" />
</xsd:schema>
</wsdl:types>
<wsdl:message name="policiesForPersonRequest">
<wsdl:part name="policiesForPerson" element="pols:policiesForPersonRequest" />
</wsdl:message>
<wsdl:message name="policiesOutput">
<wsdl:part name="policies" element="pols:policiesResponse" />
</wsdl:message>
<wsdl:portType name="MyMinfinService">
<wsdl:operation name="getPoliciesForPerson">
<wsdl:input message="policiesForPersonRequest" />
<wsdl:output message="policiesOutput" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="MyMinfinServiceHTTPBinding" type="MyMinfinService">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="getPoliciesForPerson">
<wsdlsoap:operation soapAction="" />
<wsdl:input>
<wsdlsoap:body use="literal" />
</wsdl:input>
<wsdl:output>
<wsdlsoap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="MyMinfinServicePorts">
<wsdl:port binding="MyMinfinServiceHTTPBinding" name="MyMinfinService">
<wsdlsoap:address location="http://localhost:7001/bbf/MyMinfinService" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
The xsd behind it:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns="http://www.minfin.fgov.be/bbf/extern/myMinfin/policies" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.minfin.fgov.be/bbf/extern/myMinfin/policies"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="policiesForPersonRequest">
<xs:annotation>
<xs:documentation>The request from where all available policies must be returned.</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="FI_enterpriseNumber">
<xs:annotation>
<xs:documentation>The KBO / enterprise number of the financial institution.</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:length value="10" />
<xs:pattern value="[0-9]{10}" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="RRNOrBIS">
<xs:annotation>
<xs:documentation>The national number or bis number.</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:length value="11" />
<xs:pattern value="[0-9]{11}" />
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="policiesResponse">
<xs:annotation>
<xs:documentation>Available policies.</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="policy" maxOccurs="999">
<xs:annotation>
<xs:documentation>A policy.</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="policyNumber" >
<xs:annotation>
<xs:documentation>Insurance policy number.</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:length value="255" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="policyName" type="xs:string">
<xs:annotation>
<xs:documentation>The name of the policy.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
I'm getting the following error:
wsdl:binding "{http://www.minfin.fgov.be/bbf/extern/myMinfin}MyMinfinServiceHTTPBinding" not found in the wsdl: file:/C:/BBF2/FUP_04_Implementation/FUP_00_Source/Project_Folder/BBF_EXTERNAL_CONTRACTS/src/main/resources/myMinfin/myMinfin.wsdl
what could be wrong?
Love the error.. Problem is fixed.
replaced
xmlns="http://www.minfin.fgov.be/bbf/extern/myMinfin"
with
xmlns="http://www.minfin.fgov.be/bbf/extern/myMinfin/"
took me 3hours to find!
javax.xml.ws.WebServiceException: Could not find wsdl:binding operation info for web method XXXX.
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:125)
at com.sun.proxy.$Proxy82.XXXXX(Unknown Source)
If this error occurred then add annotation Webservice to your client side interface which is already developed on service side.
I faced this issue; I have configured Spring with CXF. I have already developed the service and calling it from client.
Hope this will help.

SOAP request returned wsdl instead of expected SOAP response

I have a problem with my SOAP request. When I have tried the below soap request to the server then it returns the
expected result.
Location : https://YOUR_SERVER/apitransactional/services/TransactionalService?wsdl
Input:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:api="http://api.service.apitransactional.emailvision.com/">
<soapenv:Header/>
<soapenv:Body>
<api:openApiConnection>
<login>usernaem</login>
<pwd>password</pwd>
<key>security-key</key>
</api:openApiConnection>
</soapenv:Body>
</soapenv:Envelope>
Output:
<soap:Envelope>
<soap:Body>
<ns2:openApiConnectionResponse>
<return>G9X7CsNn3HisxFdwAu4W76mBewQgH9WW-3CyeO9WBMiHXX_u9ufLHDkA-NypiiYFGh7FLbEz2_c1YonjauDs7Jhk9DGvGNSTLMTjdz5wT2V20E4m3axKPzEnjrvzC63ItFzBIYIeYXHxjKf3w9Yxmmhz5SSeXg</return>
</ns2:openApiConnectionResponse>
</soap:Body>
</soap:Envelope>
It returns token of this connection.
But when I tried to the below request then it returns the whole wsdl file instead of
success / fail response.
Location: http://api.notificationmessaging.com/NMSOAP/NotificationService?wsdl
Input:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:api="http://api.service.nsapi.emailvision.com/">
<soapenv:Header/>
<soapenv:Body>
<api:sendObjectsWithFullStatus>
<arg0>
<sendrequest>
<content>
<entry>
<key>1</key>
<value>>
<![CDATA[
<table width="600">
<tr>
<td>
<font size="2" face="Arial">Our powerful algorithms
already found a matching profile that matches your criteria:
<br>Celina72 </font>
<img src="http://mypath/to/my/image.gif" width="50"
height="50" border="0" />
</td>]]></value>
</entry>
</content>
<dyn>
<entry>
<key>firstname</key>
<value>john</value>
</entry>
</dyn>
<email>jblum#flowerpowershop.biz</email>
<encrypt>BdX7CqkmjTHtxWEKB5QK6MzXKkx6HK3E8guM</encrypt>
<notificationId>1234</notificationId>
<random>4A776E3602000078</random>
<senddate>2008-12-12T00:00:00</senddate>
<synchrotype>NOTHING</synchrotype>
<uidkey>EMAIL</uidkey>
</sendrequest>
<sendrequest>
<content>
<entry>
<key>1</key>
<value>>
<![CDATA[
<table width="600">
<tr>
<td>
<font size="2" face="Arial">Our powerful
algorithms already found a matching profile that matches your criteria:
<br>Celina72 </font>
<img src="http://mypath/to/my/image.gif" width-
h="50" height="50" border="0" />
</td>]]></value>
</entry>
</content>
<dyn>
<entry>
<key>firstname</key>
<value>David</value>
</entry>
</dyn>
<email>dcoulon#flowerpowershop.biz</email>
<encrypt>BdX7CqkmjTHtxWEKB5QK6MzXKkx6HK3E8guM</encrypt>
<notificationId>1234</notificationId>
<random>4A776E3602000078</random>
<senddate>2008-12-12T00:00:00</senddate>
<synchrotype>UPDATE</synchrotype>
<uidkey>EMAIL</uidkey>
</sendrequest>
</arg0>
</api:sendObjectsWithFullStatus>
</soapenv:Body>
</soapenv:Envelope>
Output:
<?xml version='1.0' encoding='UTF-8' ?>
<wsdl:definitions name="NotificationServiceService" targetNamespace="http://api.service.nsapi.emailvision.com/">
<wsdl:types>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://api.service.nsapi.emailvision.com/">
<xs:element name="MultiSendRequest" type="tns:multiSendRequest" />
<xs:element name="MultiSendRequestResponse" type="tns:multiSendRequestResponse" />
<xs:element name="getSendRequestById" type="tns:getSendRequestById" />
<xs:element name="getSendRequestByIdResponse" type="tns:getSendRequestByIdResponse" />
<xs:element name="notificationExceptionDetails" type="tns:notificationExceptionDetails" />
<xs:element name="sendObject" type="tns:sendObject" />
<xs:element name="sendObjectResponse" type="tns:sendObjectResponse" />
<xs:element name="sendObjects" type="tns:sendObjects" />
<xs:element name="sendObjectsResponse" type="tns:sendObjectsResponse" />
<xs:element name="sendObjectsWithFullStatus" type="tns:sendObjectsWithFullStatus" />
<xs:element name="sendObjectsWithFullStatusResponse" type="tns:sendObjectsWithFullStatusResponse" />
<xs:element name="sendrequest" type="tns:sendRequest" />
<xs:element name="sendrequestresponse" type="tns:sendRequestResponse" />
<xs:complexType name="sendObjects">
<xs:sequence>
<xs:element minOccurs="0" name="arg0" type="tns:multiSendRequest" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="multiSendRequest">
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" name="sendrequest" nillable="true" type="tns:sendRequest" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="sendRequest">
<xs:sequence>
<xs:element name="content">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" name="entry">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="key" type="xs:int" />
<xs:element minOccurs="0" name="value" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="dyn">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" name="entry">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="key" type="xs:string" />
<xs:element minOccurs="0" name="value" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element minOccurs="0" name="email" type="xs:string" />
<xs:element minOccurs="0" name="encrypt" type="xs:string" />
<xs:element name="notificationId" type="xs:long" />
<xs:element minOccurs="0" name="random" type="xs:string" />
<xs:element minOccurs="0" name="senddate" type="xs:dateTime" />
<xs:element minOccurs="0" name="synchrotype" type="tns:synchroType" />
<xs:element minOccurs="0" name="uidkey" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="sendObjectsResponse">
<xs:sequence>
<xs:element minOccurs="0" name="return" type="tns:multiSendRequestResponse" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="multiSendRequestResponse">
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" name="element" nillable="true" type="tns:notificationServiceResponse" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="notificationServiceResponse">
<xs:sequence>
<xs:element minOccurs="0" name="result" type="xs:anyType" />
</xs:sequence>
<xs:attribute name="email" type="xs:string" />
<xs:attribute name="responseStatus" type="xs:string" />
</xs:complexType>
<xs:complexType name="notificationExceptionDetails">
<xs:sequence>
<xs:element minOccurs="0" name="description" type="xs:string" />
<xs:element maxOccurs="unbounded" minOccurs="0" name="fields" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="status" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="getSendRequestById">
<xs:sequence>
<xs:element name="arg0" type="xs:long" />
<xs:element minOccurs="0" name="arg1" type="xs:string" />
<xs:element minOccurs="0" name="arg2" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="getSendRequestByIdResponse">
<xs:sequence>
<xs:element minOccurs="0" name="return" type="tns:sendRequestResponse" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="sendRequestResponse">
<xs:sequence>
<xs:element minOccurs="0" name="email" type="xs:string" />
<xs:element name="id" type="xs:long" />
<xs:element name="notificationId" type="xs:long" />
<xs:element minOccurs="0" name="processDate" type="xs:dateTime" />
<xs:element minOccurs="0" name="requestDate" type="xs:dateTime" />
<xs:element minOccurs="0" name="sendDate" type="xs:dateTime" />
<xs:element minOccurs="0" name="status" type="xs:string" />
<xs:element minOccurs="0" name="UId" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="sendObject">
<xs:sequence>
<xs:element minOccurs="0" name="arg0" type="tns:sendRequest" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="sendObjectResponse">
<xs:sequence>
<xs:element minOccurs="0" name="return" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="sendObjectsWithFullStatus">
<xs:sequence>
<xs:element minOccurs="0" name="arg0" type="tns:multiSendRequest" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="sendObjectsWithFullStatusResponse">
<xs:sequence>
<xs:element minOccurs="0" name="return" type="tns:multiSendRequestResponse" />
</xs:sequence>
</xs:complexType>
<xs:simpleType name="synchroType">
<xs:restriction base="xs:string">
<xs:enumeration value="NOTHING" />
<xs:enumeration value="INSERT" />
<xs:enumeration value="UPDATE" />
<xs:enumeration value="INSERT_UPDATE" />
</xs:restriction>
</xs:simpleType>
</xs:schema>
<xsd:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://exceptions.service.nsapi.emailvision.com/">
<xsd:element name="NotificationServiceException" nillable="true" type="ns0:notificationExceptionDetails" />
</xsd:schema>
</wsdl:types>
<wsdl:message name="getSendRequestByIdResponse">
<wsdl:part element="tns:getSendRequestByIdResponse" name="parameters" />
</wsdl:message>
<wsdl:message name="sendObjectsWithFullStatus">
<wsdl:part element="tns:sendObjectsWithFullStatus" name="parameters" />
</wsdl:message>
<wsdl:message name="NotificationServiceException">
<wsdl:part element="ns1:NotificationServiceException" name="NotificationServiceException" />
</wsdl:message>
<wsdl:message name="sendObjectResponse">
<wsdl:part element="tns:sendObjectResponse" name="parameters" />
</wsdl:message>
<wsdl:message name="sendObjectsResponse">
<wsdl:part element="tns:sendObjectsResponse" name="parameters" />
</wsdl:message>
<wsdl:message name="getSendRequestById">
<wsdl:part element="tns:getSendRequestById" name="parameters" />
</wsdl:message>
<wsdl:message name="sendObjectsWithFullStatusResponse">
<wsdl:part element="tns:sendObjectsWithFullStatusResponse" name="parameters" />
</wsdl:message>
<wsdl:message name="sendObjects">
<wsdl:part element="tns:sendObjects" name="parameters" />
</wsdl:message>
<wsdl:message name="sendObject">
<wsdl:part element="tns:sendObject" name="parameters" />
</wsdl:message>
<wsdl:portType name="NotificationService">
<wsdl:operation name="sendObjects">
<wsdl:input message="tns:sendObjects" name="sendObjects" />
<wsdl:output message="tns:sendObjectsResponse" name="sendObjectsResponse" />
<wsdl:fault message="tns:NotificationServiceException" name="NotificationServiceException" />
</wsdl:operation>
<wsdl:operation name="getSendRequestById">
<wsdl:input message="tns:getSendRequestById" name="getSendRequestById" />
<wsdl:output message="tns:getSendRequestByIdResponse" name="getSendRequestByIdResponse" />
<wsdl:fault message="tns:NotificationServiceException" name="NotificationServiceException" />
</wsdl:operation>
<wsdl:operation name="sendObject">
<wsdl:input message="tns:sendObject" name="sendObject" />
<wsdl:output message="tns:sendObjectResponse" name="sendObjectResponse" />
<wsdl:fault message="tns:NotificationServiceException" name="NotificationServiceException" />
</wsdl:operation>
<wsdl:operation name="sendObjectsWithFullStatus">
<wsdl:input message="tns:sendObjectsWithFullStatus" name="sendObjectsWithFullStatus" />
<wsdl:output message="tns:sendObjectsWithFullStatusResponse" name="sendObjectsWithFullStatusResponse" />
<wsdl:fault message="tns:NotificationServiceException" name="NotificationServiceException" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="NotificationServiceServiceSoapBinding" type="tns:NotificationService">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="sendObjects">
<soap:operation soapAction="" style="document" />
<wsdl:input name="sendObjects">
<soap:body use="literal" />
</wsdl:input>
<wsdl:output name="sendObjectsResponse">
<soap:body use="literal" />
</wsdl:output>
<wsdl:fault name="NotificationServiceException">
<soap:fault name="NotificationServiceException" use="literal" />
</wsdl:fault>
</wsdl:operation>
<wsdl:operation name="getSendRequestById">
<soap:operation soapAction="" style="document" />
<wsdl:input name="getSendRequestById">
<soap:body use="literal" />
</wsdl:input>
<wsdl:output name="getSendRequestByIdResponse">
<soap:body use="literal" />
</wsdl:output>
<wsdl:fault name="NotificationServiceException">
<soap:fault name="NotificationServiceException" use="literal" />
</wsdl:fault>
</wsdl:operation>
<wsdl:operation name="sendObject">
<soap:operation soapAction="" style="document" />
<wsdl:input name="sendObject">
<soap:body use="literal" />
</wsdl:input>
<wsdl:output name="sendObjectResponse">
<soap:body use="literal" />
</wsdl:output>
<wsdl:fault name="NotificationServiceException">
<soap:fault name="NotificationServiceException" use="literal" />
</wsdl:fault>
</wsdl:operation>
<wsdl:operation name="sendObjectsWithFullStatus">
<soap:operation soapAction="" style="document" />
<wsdl:input name="sendObjectsWithFullStatus">
<soap:body use="literal" />
</wsdl:input>
<wsdl:output name="sendObjectsWithFullStatusResponse">
<soap:body use="literal" />
</wsdl:output>
<wsdl:fault name="NotificationServiceException">
<soap:fault name="NotificationServiceException" use="literal" />
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="NotificationServiceService">
<wsdl:port binding="tns:NotificationServiceServiceSoapBinding" name="NotificationServicePort">
<soap:address location="http://api.notificationmessaging.com/nsapi/services/NotificationService" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Expected Output:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns2:sendObjectResponse xmlns:n-
s2="http://api.service.nsapi.emailvision.com/">
<return>SendRequest has been successfully saved!</return>
</ns2:sendObjectResponse>
</soap:Body>
</soap:Envelope>
Can anyone suggest what is the actual problem is?
Does this problem from my request or from the server response?
Is there a specific reason to add ?wsdl to your endpoint address? Response from server(http://api.notificationmessaging.com/NMSOAP/NotificationService) is, not what you expected but definitely not WSLD
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns2:sendObjectsWithFullStatusResponse xmlns:ns2="http://api.service.nsapi.emailvision.com/">
<return>
<element responseStatus="failed" email="jblum#flowerpowershop.biz">
<result xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns4="http://www.w3.org/2001/XMLSchema" xsi:type="ns4:string">
Query random: 4A776E3602000078 doesnt match with notification random: {1} !!!
</result>
</element>
<element responseStatus="failed" email="dcoulon#flowerpowershop.biz">
<result xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns4="http://www.w3.org/2001/XMLSchema" xsi:type="ns4:string">
Query random: 4A776E3602000078 doesnt match with notification random: {1} !!!
</result>
</element>
</return>
</ns2:sendObjectsWithFullStatusResponse>
</soap:Body>
</soap:Envelope>
Can you check that particular operation mplementation at server side. It must have been sending that wsdl in response instead of your desired response. Also you can check your soap action once, may be due to wrong soap action server is filtering your request by sending you a wsdl, Though i am not seeing any soap action in your wsdl.
I have tried this wsdl in soapui, i am getting proper response from it.Though it is unsuccessful.
Query random: 4A776E3602000078 doesnt match with notification random: {1} !!!
Query random: 4A776E3602000078 doesnt match with notification random: {1} !!!

getting soap:Fault while consuming a soap service

I have a soap client which consumes a remote soap service. Everything is fine with the connection and setup. when I send a soap request, I get a soap fault message as following:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>Index: 0, Size: 0</faultstring>
</soap:Fault>
</soap:Body>
</soap:Envelope>
Now I am really having hard time understanding such error message. just for the fact, I know everything is fine with the request envelope. Could anyone please help me understand this error.
Here is the SOAP request Envelope:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns2:createRequest xmlns:ns2="http://request.services.xyz.com/">
<hid>1234</hid>
<requestTypeCode>APPOINT_REQ</requestTypeCode>
<createdBy>testuser</createdBy>
<assignedTo>testuser</assignedTo>
<data>
<dataField>
<name>ContentText</name>
<value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">Test!</value>
</dataField>
<dataField>
<name>Date</name>
<value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:dateTime">2013-12-09T13:28:34.009-05:00</value>
</dataField>
<dataField>
<name>OrderNumber</name>
<value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">1-123432</value>
</dataField>
</data>
<originAppCode>ABCD</originAppCode>
</ns2:createRequest>
</soap:Body>
</soap:Envelope>
And here is the method signature which I am trying to invoke with the SOAP request.
public #XmlElement(name="Request")Request createRequest( #WebParam(name="hid")int hid, #WebParam(name="requestTypeCode")String requestTypeCode, #WebParam(name="createdBy")String createdBy,
#WebParam(name="assignedTo")String assignedTo, #WebParam(name="createTime")Date createTime, #WebParam(name="data")DataFields data, #WebParam(name="originAppCode") String originAppCode) throws Exception;
here is the part of wsdl :
<wsdl:definitions xmlns:ns1="http://cxf.apache.org/bindings/xformat" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://request.services.xyz.com/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="requestServiceImplService" targetNamespace="http://request.services.xyz.com/">
<wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://jaxb.dev.java.net/array" version="1.0">
<xs:complexType final="#all" name="stringArray">
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" name="item" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
<xs:schema xmlns:tns="http://request.services.xyz.com/" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="unqualified" targetNamespace="http://request.services.xyz.com/" version="1.0">
<xs:element name="createRequest" type="tns:createRequest"/>
<xs:element name="createRequestResponse" type="tns:createRequestResponse"/>
<xs:element name="dataFields" type="tns:dataFields"/>
<xs:complexType name="createRequest">
<xs:sequence>
<xs:element name="hid" type="xs:int"/>
<xs:element minOccurs="0" name="requestTypeCode" type="xs:string"/>
<xs:element minOccurs="0" name="createdBy" type="xs:string"/>
<xs:element minOccurs="0" name="assignedTo" type="xs:string"/>
<xs:element minOccurs="0" name="createTime" type="xs:dateTime"/>
<xs:element minOccurs="0" name="data" type="tns:dataFields"/>
<xs:element minOccurs="0" name="originAppCode" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="createRequestResponse">
<xs:sequence>
<xs:element minOccurs="0" name="return" type="tns:request"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="dataFields">
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" name="dataField" type="tns:dataField"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="dataField">
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="value" type="xs:anyType"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
</wsdl:types>
<wsdl:message name="createRequest">
<wsdl:part element="tns:createRequest" name="parameters"></wsdl:part>
</wsdl:message>
<wsdl:message name="createRequestResponse">
<wsdl:part element="tns:createRequestResponse" name="parameters"></wsdl:part>
</wsdl:message>
<wsdl:operation name="createRequest">
<wsdl:input message="tns:createRequest" name="createRequest"></wsdl:input>
<wsdl:output message="tns:createRequestResponse" name="createRequestResponse"> </wsdl:output>
</wsdl:operation>
<wsdl:binding name="RequestServiceImplServiceSoapBinding" type="tns:IRequestService">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="createRequest">
<soap:operation soapAction="" style="document"/>
<wsdl:input name="createRequest">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="createRequestResponse">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="RequestServiceImplService">
<wsdl:port binding="tns:RequestServiceImplServiceSoapBinding" name="RequestServiceImplPort">
<soap:address location="location_where_service_is_being_hosted/cxf/jaxws/RequestService"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Messages like Index: 0, Size: 0 are often caused by IndexOutOfBoundsExceptions.
In you're case that could mean:
The request is empty.
The request has the wrong encoding.
Security mechanisms won't let your request through.
There is an IndexOutOfBoundsException in the backend.
Next steps:
Check if your server accepts requests from SoapUI.
You have full control over the request, so if something goes wrong, it's probably an error in the backend.
If it works, there's a problem in your client. Check the request your client is sending. Is it complete? Does it contain unreadable characters?
Result: That error also occurs when using SoapUI.
XML / XML Schema
Some things in the XML and XML Schema attracted my attention.
In the request only createRequest uses a namespace. The other elements don't have a namespace, because they don't specify a namespace prefix. Using <createRequest xmlns="http://request.services.xyz.com/"> would assign a default namespace to all elements below createRequest.
(In XML Schema there is a reference to type="tns:dataFields" although there is only dataField. Also createRequest is lower case while in the request it's written with camel case. I assume both are not real problems, because you changed the names for StackOverflow.)
Server error
Since it's not possible to send any request the server accepts (not even with SoapUI), you definitly have to debug the server.
Is there any error message in the log?
Where does the Exception occur? Set a break point on java.lang.Exception and narrow it down until you find the problem.

Categories