Menu
  • HOME
  • TAGS

Spring-ws multiple request in one request

java,spring,spring-ws

This should help you: <xsd:element name="SendMemberStatusRequest"> <xsd:complexType> <xsd:element name="MemberStatusRequest" type="member:MemberStatusRequest" maxOccurs="unbounded"/> </xsd:complexType> </xsd:element> By default minOccurs/maxOccurs is "1". Your Request Class on the matter should have List<MemberStatusRequest> requests property....

Spring Web service unmarshalling not happening correctly

spring,web-services,jaxb,unmarshalling,spring-ws

Answering my own question after getting frustrated for hours.There seems to be problem with the namespaces in wsdl.I changed following 2things in wsdl and generated the classes again resulting in proper responses. xmlns:tns1="http://fs.uk.com" to xmlns:tns1="http://service.fs.uk.com" targetNamespace="http://fs.uk.com" to targetNamespace="http://service.fs.uk.com" for element FSChild. It was little surprising for me as original wsdl...

Extra SOAP information in request

java,xml,soap,jaxb,spring-ws

Yes, all this extra stuff such as inner Envelope and TransactInfo is service-related. Third-party service requires this info exactly in this way. And no other options left expect support this manually.

NoClassDefFound after adding spring-ws dependency

spring,maven,spring-ws

Try to exclude the transitive spring framework dependencies of the spring-ws-core dependency. But just exclude the dependencies which you already define with another version in your project. For example like this: <dependency> <groupId>org.springframework.ws</groupId> <artifactId>spring-ws-core</artifactId> <version>2.1.4.RELEASE</version> <exclusions> <exclusion> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId>...

How to get HttpServletRequest in apache Camel based spring-ws EIP flow

apache-camel,spring-ws

From http://docs.spring.io/spring-ws/sites/1.5/reference/html/common.html: TransportContext context = TransportContextHolder.getTransportContext(); HttpServletConnection connection = (HttpServletConnection )context.getConnection(); HttpServletRequest request = connection.getHttpServletRequest(); String ipAddress = request.getRemoteAddr(); Or use CXF instead of Spring-WS. CXF is from the same kitchen as Camel and therefore may be better integrated. With CXF you have access to the ServletRequest as follows (see...

Spring Web Service Message Dispatcher overrriding

spring-ws

If we take a look to the default MessageDispatcher infrastructure, we'll that it reads appropriate proerties file - org.springframework.ws.server.MessageDispatcher.properties. As you see this file is located at the same package as the original MessageDispatcher class. According to your concern, you are right: that file should be located at the resources...

Testing CXF Client with Spring WS Test

java,web-services,cxf,spring-ws

No. The spring-ws-test module is specific to Spring-WS and cannot be used with other frameworks. You can use SoapUI for that, for instance.

Mixing of XOP/MTOM and attachments is not allowed

java,web-services,soap,spring-ws,mtom

After more investigation, it seems that weblogic overrides some of the classes or somehow confuses the classpath. In our case it was Saaj implementation. We had to add the saaj-impl-1.3.20.jar into our class-path and it worked. We also upgraded to spring-ws 2.2.0 and set the mtom to enable on the...

Convert StreamResult to string or xml

java,spring-mvc,soap,spring-ws

try like this one try { StreamSource source = new StreamSource(new StringReader("<xml>blabla</xml>")); StringWriter writer = new StringWriter(); StreamResult result = new StreamResult(writer); TransformerFactory tFactory = TransformerFactory.newInstance(); Transformer transformer = tFactory.newTransformer(); transformer.transform(source,result); String strResult = writer.toString(); } catch (Exception e) { e.printStackTrace(); } } ...

Java Config for Spring Web Service Marshallers

spring-ws

Marshallers can just be registered by using a regular @Bean definition. For instance, consider this sample app configuration.

WSS4J with Spring WS (user/password authentication + .cert)

security,encryption,certificate,spring-ws,wss4j

The solution for this scenario: First of all, import the .cer file to your own keystore: keytool -importcert -v -trustcacerts -file "path\to\file.cer" -alias myAlias -keystore "myNewKeyStore.jks" -storepass myPass Put the file under your classpath If you are using maven, configure it to include .jks files and NO FILTERING for this...

Spring-boot soap webservice with MVC

java,spring,spring-mvc,spring-boot,spring-ws

The problem lies in the registration of the MessageDispatcherServlet due to the name dispatcherServlet it overrides the by Spring Boot registered DispatcherServlet. The latter is needed for the MVC part of your website. To fix it just rename your method to anything but dispatcherServlet say messageDispatcherServlet. @Bean public ServletRegistrationBean messageDispatcherServlet(ApplicationContext...

Save Spring-ws webservicetemplate request to DB in XML Format

java,spring,web-services,marshalling,spring-ws

Turned out to be a simple solution, unfortunately couldn't find it earlier. Key was to use Inject configured Jaxb2Marshaller! @Autowired private Jaxb2Marshaller serviceMarshaller; javax.xml.transform.stream.StreamResult result = new StreamResult(new StringWriter()); serviceMarshaller.marshal(request, result); String xml = result.getWriter().toString(); ...

JAXB2 source generation

java,web-services,hibernate,jaxb,spring-ws

You can use jaxb:class/@ref binnding to tell XJC you already have a User class. See this question: JAXB: Prevent classes from being regenerated But I'd personally just write the two classes you need for the endpoint per hand and avoid the schema compilation altogether....

Spring-WS set SOAPAction header for SOAP version 1.2

java,web-services,soap,spring-ws

A separate SOAPAction header is used only in SOAP 1.1. In SOAP 1.2, the action is expected to be set as a parameter in the Content-Type header, and as you have seen, Spring-WS contains the necessary code to set that parameter. If that parameter is lost, then it is most...

Spring Integration: JDBC single query to web service

spring-mvc,soap,integration,spring-integration,spring-ws

Since you say that you'd prefer to select on the application start up and only once, you can use: <int-event:inbound-channel-adapter channel="jdbcChannel" event-types="org.springframework.context.event.ContextRefreshedEvent" payload-expression="''"/> and <int-jdbc:outbound-gateway query="SELECT * FROM ..."/> And so on to the WebService. UPDATE Since you say that you are around Anotation configuration, consider to use Spring Integration...

Spring: Logging outgoing HTTP requests

java,spring,spring-ws

Intercept the request/response using a ClientInterceptor on the WebServiceGatewaySupport: // soapClient extends WebServiceGatewaySupport soapClient.setInterceptors(new ClientInterceptor[]{new ClientInterceptor() { @Override public boolean handleRequest(MessageContext messageContext) throws WebServiceClientException { ByteArrayOutputStream os = new ByteArrayOutputStream(); try { messageContext.getRequest().writeTo(os); } catch (IOException e) { throw new WebServiceIOException(e.getMessage(), e); } String request = new...

Spring web Services client and server - No Endpoint mapping found

java,xml,spring,web-services,spring-ws

The log message states that the endpoint should match the namespace="http://localhost:10301/0301-ws-xmlconfig-service" and is expecting UserRequest, so the localPart should match UserRequest.

How to use spring-ws client to call the same webservice using different keystore

java,spring,ssl,https,spring-ws

I found a solution. It's not perfect, or completely clean. I need more test to be sure thats working, at the moment it is running. This is the magical FactoryBean "CustomSSLHttpClientFactory.java". package foo.bar.services; import java.io.InputStream; import java.net.Socket; import java.security.KeyStore; import java.util.Map; import javax.net.ssl.SSLContext; import org.apache.http.client.HttpClient; import org.apache.http.config.Registry; import org.apache.http.config.RegistryBuilder; import...

Testing Spring JAX-WS Web Services

spring,unit-testing,spring-ws

No, the MockWebServiceClient works with Spring-WS services only.

WS-Security with Apache Camel and Spring-WS

java,spring,apache-camel,spring-ws

I eventually found that running "mvn eclipse:eclipse" had messed up my Eclipse project files, which in turn was causing Eclipse to not update dependencies. After a quick delete/import existing maven projects, things look as expected.

Spring-WS and Spring-integration: Getting SAXParseException: smartLifeCycleAttributeGroup

spring-integration,spring-ws

Or you have a mixing of spring-integration jar versions (SI-ws is of one version, but SI-core is of another), or it is just an issue of your IDE. The Spring Nature (STS) should help to resolve all XSD validation issues....

Spring boot using Spring Security authentication failure when using SpringPlainTextPasswordValidationCallbackHandler in an XwsSecurityInterceptor

spring-security,spring-boot,spring-ws,ws-security

Ok I figured this out so though I would post for anyone trying this in the future. I resolved this problem by changing my spring boot class to: @SpringBootApplication @EnableGlobalMethodSecurity(securedEnabled = true) public class SwitchxApplication extends WebMvcConfigurerAdapter { @SuppressWarnings("unused") private static final Logger log = LoggerFactory.getLogger(SwitchxApplication.class); @Bean public ApplicationSecurity applicationSecurity()...

understand spring-ws, integration with spring-mvc and automatic generation of wsdl

java,spring,web-services,wsdl,spring-ws

The problem is that your xsd is wrong. You should wrap your complex types in an element. <xs:element name="deliverShortMessageRequest"> <xs:complexType> <xs:sequence> <xs:element name="parameters" minOccurs="0"> <xs:complexType> <xs:sequence> <xs:element name="sms" type="tns:deliverShortMessage"/> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element /> <xs:element name="deliverShortMessageResponse">...

org.springeframework.ws.soap.client.SoapFaultClientException in jBoss 7.1.1

spring,web-services,jboss,client,spring-ws

Fixed this one on my own: SoapFaultClientException: Exception is thrown by WebService! My request lacked some parameters that where obligated. Even altough the wsdl did not mention them as required. ==> The problem was not JBoss specific, what I first thought. (Sorry for shaming you Jboss, but I still do...

How to log SOAP messages on client side?

java,jax-ws,soap-client,spring-ws,java-ws

The answer you talk about seems to refer to CXF-based implementation of SOAP Client. In that sort of implementation, you have to add logging interceptors to endpoint. You can use some sort of implementation with Spring if you want, and you can configure everything without any XML, tell me if...

Producing SOAP webservices with spring-ws with Soap v1.2 instead of the default v1.1

soap,spring-ws,soapserver

You are mixing Spring-WS with annotations from JAX-WS (package javax.xml.ws). That won't work. To configure Spring-WS to use SOAP 1.2, add the following bean definition: @Bean public SaajSoapMessageFactory messageFactory() { SaajSoapMessageFactory messageFactory = new SaajSoapMessageFactory(); messageFactory.setSoapVersion(SoapVersion.SOAP_12); return messageFactory; } ...

How to set OsgiBundleXmlApplicationContext as parent of WebApplicationContext

spring,apache-camel,spring-ws,apache-karaf,spring-dm

The solution is actually straight forward and documented in the JavaDoc of FrameworkServlet, which the MessageDispatcherServlet extends: One can set an ApplicationContextInitializer on the MessageDispatcherServlet. Use the context initializer to set the current application context as the parent of the servlet's application context. For this you have to also implement...

How to extract SOAP header from a WS response using spring-ws and jaxb

java,spring,jaxb,spring-ws

Implement a ClientInterceptor, specifically see handleResponse() method. In order to access the Soap Headers, convert to a SoapMessage public final boolean handleResponse(MessageContext messageContext, Object endpoint) throws Exception { QName v1ResponseHeaderQName = null;//todo QName statusAttrQName = null;//todo SoapMessage message = (SoapMessage) messageContext.getResponse(); Iterator<SoapHeaderElement> matchingHeaders = message.getSoapHeader().examineHeaderElements(v1ResponseHeaderQName); String status =...

Spring: Response time

java,spring,spring-ws

Yes, implementing an EndpointInterceptor is the best fit for this task, as it gives you access to the SOAP messages through the MessageContext. See the Reference Documenation.

Spring Boot- Producing a SOAP web service that expects application/soap+xml content type

web-services,soap,spring-boot,spring-ws,soap1.2

You need to configure Spring WS to use SOAP 1.2, as explained here: Producing SOAP webservices with spring-ws with Soap v1.2 instead of the default v1.1...

What's the proper way of configuring a SoapActionSmartEndpointInterceptor along with AnnotationActionEndpointMapping

java,spring-ws

I think this is a bug: the AnnotationActionEndpointMapping should also call shouldIntercept on its smart interceptor chain. Could you please create a JIRA for this here, possibly linking to this SO question? Or better yet, provide a pull request?

SOAP webservice endpoint from WSDL

java,web-services,soap,wsdl,spring-ws

Getting a 405 (Method not Allowed) error code when accessing a SOAP service with a browser (i.e. via a GET) is actually correct behavior: all SOAP HTTP access is done via a POST, not a GET. You can try pointing a SOAP client at the WSDL ( SoapUI for example),...

Custom SoapFault exception resolver not being used

spring,spring-boot,spring-ws

As usual, I solve my problem an hour aftour posting it online. I should do it earlier ! The bean name/id I tried to override was not right. After scanning a huge amount of org.springframework.beans debug logs, I found that the right bean name is "soapFaultAnnotationExceptionResolver". In the same time,...