Quantcast
Channel: Spring Community Forums - Web Services
Viewing all 278 articles
Browse latest View live

solid glass microspheres

$
0
0
We can supply blue glass beads, red glass beads, green glass beads, yellow glass beads, black glass beads, white glass beads, purple glass beads, pink glass beads, grey glass beads, etc. with competitive price and high quality!

APAM

APAM In The Treatment Of Industrial Waste Water
Anionic PAM widely used in the treatment of the sewage with suspended grains, high concentration, postive charges and mid or sidali PH value, the waste water from a iron and steel plant, an electroplating factory and a coal washing works, and metallurgical waste water

sodium hexametaphosphate SHMP

$
0
0
Usage:Sodium hexametaphosphate used as water-conservative. Applied to can, fruit drinks, milk product, vegetable protein drinks, instant noodles, meat product, and so on. SHMP sodium hexametaphosphate used as stabilizer and freezing agent and applied to
Packing:25 kg/bag inner plastic and outer plait

propylene glycol

Propylene glycol Uses:
Propane-1,2-diol is the raw material for preparing unsaturated polyester resin, plasticizer, surface active agent, emulsifying agent and demulsifying agent. Propylene glycol food grade can also be used as mould inhibitor, antiseptic for fruit, ice inhibitor and moisture preserving agent for tobacco.

Invalid attribute in the element

$
0
0
Hi,

I'm using Spring web services 2.1.2 and spring web services security 2.1.2. I'm trying to add signature and signature validation to my web services endpoints using the XwsSecurityInterceptor. I'm using the same interceptor on the client side to sign soap messages.
The framework generates the following <ds:Signature element inside the ws security header :
...
<ds:Signature Id="XWSSGID-1369122069486-1039667443" xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:SignedInfo>
...

This is valid according to the xsd but The presence of the optional Id attribute on the signature element causes parsing issue on the server side :
10:23:46,515 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/etrustex].[services]] (http--127.0.0.1-8080-2) Servlet.service() for servlet services threw exception: org.w3c.dom.DOMException: NOT_FOUND_ERR: An attempt is made to reference a node in a context where it does no
t exist.
at org.apache.xerces.dom.ElementImpl.setIdAttributeNS (ElementImpl.java:1000) [xercesImpl-2.8.0.jar:]
at net.sf.saxon.dom.DOMWriter.attribute(DOMWriter.jav a:154) [Saxon-HE-9.4.jar:]
at net.sf.saxon.event.ProxyReceiver.attribute(ProxyRe ceiver.java:158) [Saxon-HE-9.4.jar:]
at net.sf.saxon.event.ReceivingContentHandler.startEl ement(ReceivingContentHandler.java:340) [Saxon-HE-9.4.jar:]

I'm using JBoss 7 and saxon 9.4 at the server side. If I remove the optional attribute or change it to id instead of Id it works fine.

Does someone have a clue on what happens ?

Thanks in advance

Consume web service on SSL with user certificate

$
0
0
Hi,

Is there any way to consume a web service from a server that is only accessible over ssl built on client certificate? I would like to avoid applets or consume it directly with javascript...

Thanks!

Web Services Test

$
0
0
Trying to learn how to create web services.... trying the link below...

http://www.tutorialspoint.com/webser...s_examples.htm

I get about half way down and get to the below and I am lost...how is this proxy made? I have Visual Studio but an completely lost....
I was successful in putting an HTML page in there in step one and viewing it...
I created the WebApp.aspx file
now lost on the instructions below...

Can anyone help or steer me in the direction of some other learning examples or tutorials...

Example from link above
After the consumer is created, we need to create a proxy for the Web Service to be consumed. This work is done automatically by Visual Studio .NET for us when referencing a Web Service that has been added. Here are the steps to be followed:

Create a proxy for the Web Service to be consumed. The proxy is created using the wsdl utility supplied with the .NET SDK. This utility extracts information from the Web Service and creates a proxy. Thus, the proxy created is valid only for a particular Web Service. If you need to consume other Web Services, you need to create a proxy for this service as well. VS .NET creates a proxy automatically for you when the reference for the Web Service is added. Create a proxy for the Web Service using the wsdl utility supplied with the .NET SDK. It will create FirstSevice.cs in the current directory. We need to compile it to create FirstService.dll (proxy) for the Web Service.

Upgrade from Spring WS 1.5.8 to 2.0.0

$
0
0
When we use WS 1.5.8, we had Generating the WSDL with DynamicWsdl11Definition but when we go for 2.0.0, we should use DefaultWsdl11Definition.. Existing bean generation as below:

<bean id="travelerProfileSearch" class="org.springframework.ws.wsdl.wsdl11.DynamicW sdl11Definition">
<property name="buildAbstractPart" value="true" />
<property name="buildConcretePart" value="true" />
<property name="builder">
<bean class="org.springframework.ws.wsdl.wsdl11.builder. XsdBasedSoap11Wsdl4jDefinitionBuilder">
<property name="schema" value="${ws.traveler.xsd.baseUrl}/${ws.traveler.xsd.uri}/TravelerProfileSearch.xsd"/>
<property name="schemaLocation" value="${ws.traveler.xsd.baseUrl}/${ws.traveler.xsd.uri}/TravelerProfileSearch.xsd"/>
<property name="portTypeName" value="TravelerProfileSearch"/>
<property name="locationUri" value="${ws.traveler.baseUrl}/${ws.traveler.search.uri}"/>
<property name="targetNamespace" value="${ws.namespace.v1}"/>
</bean>
</property>
</bean>

Tried to re-write it using DefaultWsdl11Definition, but getting below error:

Message: WSDLException (at /wsdlefinitions/wsdl:types/xsdchema): faultCode=OTHER_ERROR: An error occurred trying to resolve schema referenced at 'XXXService.xsd', relative to '_http://vsmn00dk00062:8404/portrait-ws/update/travelerProfileUpdate.wsdl'.: java.io.IOException: Server returned HTTP response code: 405 for URL: _http://vsmn00dk00062:8404/portrait-ws/update/XXXService.xsd

can you please re-write using DefaultWsdl11Definition bean to generate WSDL.

Thanks,

Communications management with PasswordDigest (WSPasswordCallback from WSS4J)

$
0
0
Scenario:

We are developing a Java library to deploy an authentication subsystem, which acts as an intermediary of two end-points: an originator program (which sends us the SOAP message, made by the client, as a CallbackHandler implementation) and a WebService (based on CXF, which will validate de user&password given).

Here it is a logical diagram of the system:

Code:

|------|            |-------|           
|Client|--SOAP msg->|Program|
|------|            |-------|           
                      |          |--------| 
                      \-Callback->|Java Lib|
                                  |--------|                           
                                    |            |--|                |----|
                                    \-User&Pass-->|WS|<-(validation)->|LDAP|
                                                  |--|  SOAP msg    |----|

As a is seen in other other implementations the code (to be added in our Java Lib) should be the next (taking into account that the type of the password, for -obviously- security reasons, is "PasswordDigest" (seen in the OASIS UserName Token specification, lines 196-197)):

Code:

        if (callbacks[i] instanceof WSPasswordCallback) {
            WSPasswordCallback pc = (WSPasswordCallback) callbacks[i];
            sString login = pc.getIdentifier();
            String password = getPassword(login);
            pc.setPassword(password);
        }

The line
Code:

"String password = getPassword(login);"
requires the local storage of a file (or a DB) in order to the user&pass maintenance and its subsequent check-up.

So, and that is the obstacle, we are NOT allowed to maintain that file. In addition, the WebService only provides an authentication service (yes/no to an user and password given) and we don't have any other access to the originator Program or to the client.

Any idea of how we should proceed?

Thanks in advance.

restTemplate could not find message converter -- but this time it could be a bug

$
0
0
I have been using spring's restTemplate for while, but just learned a small lesson over the weekend. In fact, I think this is a bug, but like to hear experts' advice. Here is what happened.

I defined a simple java Class:

Code:

public class WebAccount extends ActivityStatus {
        private int account_id=0;
        private String login="";
        private String password="";
        private Boolean is_business=false;
        private Boolean issue_invoice=false;
        private int biller_id=0;
        private Boolean receive_invoice=true;
        private int receiver_id=0;
        private String fname="";
        private String lname="";
        private String phone_number="";
        private String email="";
        private String addr_street1="";
        private String addr_street2="";
        private String addr_city="";
        private String addr_state="";
        private String addr_zip="";
        private String business_name1="";
        private String business_name2="";
        private String business_name3="";

        … getters and setters of all attributes...
        }

In the application, a method calls restTemplate, which returns a WebAccount:

Code:

public WebAccount myProfilePage(WebKeys web_keys) {
                String url = url_root + "myProfilePage/" + web_keys.getAccount_id();
                logger.info("url: " + url);       
                WebAccount web_account = (WebAccount) restTemplate.getForObject(url, WebAccount.class);

                return web_account;
        }

The url points to a web service, defined by Spring's restFUL annotation, which is in separate body of codes:
Code:

        @RequestMapping(value="myProfilePage/{acct_id}",method=RequestMethod.GET,produces="application/json")
        public @ResponseBody
        WebAccount myProfilePage(@PathVariable("acct_id") int account_id) {
        …
        }

Back to the method "myProfilePage": just to be sure, I logged the url, and pasted it in a web browser. It returned a correct result. However, The restTemplate command in the method generated the following error message in test runs:

org.springframework.web.client.RestClientException : Could not extract response: no suitable HttpMessageConverter found for response type [org.SandRiver.WebGateway.WebAccount] and content type [application/json]

However, I do have a json message converter for restTemplate, defined in applicationContext.xml:
Code:

  <bean id="restTemplate" class="org.springframework.web.client.RestTemplate" scope="prototype">
        <property name="messageConverters">
            <list>
                <bean class="org.springframework.http.converter.ByteArrayHttpMessageConverter"/>
                <bean class="org.springframework.http.converter.FormHttpMessageConverter" />
                <bean class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter"/>
            </list>
        </property>
    </bean>

Eventually, I found out the following: in class WebAccount definition, if I remove setters for all 3 attributes of Boolean type (is_business, issue_invoices, receive_invoices), then everything is OK. Any setter for one of these attributes will bring out this exception.

Did I do anything inappropriate, or is this a bug?

Regards,

John Zhu

SOAP Authentication

$
0
0
Hi,

First of all I have little exeperience with web services... I have a web application that has the following security configuration:

Code:

        <sec:http auto-config='true'>
                <sec:intercept-url pattern="/**" access="ROLE_USER" />
        </sec:http>

        <sec:authentication-manager>
                <sec:authentication-provider>
                        <sec:password-encoder hash="sha"/>
                        <sec:user-service>
                                <sec:user name="testUser"
                                        password="0bf03e7a9fbf51a59a50171d7153d13c0a47243e"
                                        authorities="ROLE_USER, ROLE_ADMIN" />
                        </sec:user-service>
                </sec:authentication-provider>
        </sec:authentication-manager>

Now, I'm developing a web-service (to handle a SOAP request) that will run together with my webapp.
How can the client authenticate in my application to send this SOAP message?

Thanks!

RestTemplate put

$
0
0
Just realized that put method of RestTemplate returns void, it should return something (like id of new resource or new path of the resource created )if new resource is created as per w3c http put definition, am I correct? is this something wrongly interpreted?

http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html
Excerpt from above URL:
The PUT method requests that the enclosed entity be stored under the supplied Request-URI. If the Request-URI refers to an already existing resource, the enclosed entity SHOULD be considered as a modified version of the one residing on the origin server. If the Request-URI does not point to an existing resource, and that URI is capable of being defined as a new resource by the requesting user agent, the origin server can create the resource with that URI. If a new resource is created, the origin server MUST inform the user agent via the 201 (Created) response. If an existing resource is modified, either the 200 (OK) or 204 (No Content) response codes SHOULD be sent to indicate successful completion of the request. If the resource could not be created or modified with the Request-URI, an appropriate error response SHOULD be given that reflects the nature of the problem. The recipient of the entity MUST NOT ignore any Content-* (e.g. Content-Range) headers that it does not understand or implement and MUST return a 501 (Not Implemented) response in such cases.

If the request passes through a cache and the Request-URI identifies one or more currently cached entities, those entries SHOULD be treated as stale. Responses to this method are not cacheable.

The fundamental difference between the POST and PUT requests is reflected in the different meaning of the Request-URI. The URI in a POST request identifies the resource that will handle the enclosed entity. That resource might be a data-accepting process, a gateway to some other protocol, or a separate entity that accepts annotations. In contrast, the URI in a PUT request identifies the entity enclosed with the request -- the user agent knows what URI is intended and the server MUST NOT attempt to apply the request to some other resource. If the server desires that the request be applied to a different URI,

it MUST send a 301 (Moved Permanently) response; the user agent MAY then make its own decision regarding whether or not to redirect the request.

Rest Tempalte (POST)

$
0
0
Hello;
can someone show me how to use RestTemplate in order to execute this post request in server;
curl -i -X POST --data "sessionKey=eec8ff46-aaf9-485f-a7b5-452c1d7197d0&path=/contenthubfeedtest&recursive=true" http://localhost:8080/cmsadapter/contenthubfeed

Thanks;

Unexpected end of file after null

$
0
0
Hi,

this is my first time with ws and am facing a problem with it,

here is my endpoint:
Code:

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ws.server.endpoint.annotation.Endpoint;
import org.springframework.ws.server.endpoint.annotation.PayloadRoot;
import org.springframework.ws.server.endpoint.annotation.RequestPayload;
 
import com.blueoss.cis.services.PartnersService;
import com.visionoss.api.core.v8_1.transaction.TransactionStatusResponse;
 
@Endpoint
public class VOSSAsyncNotificationEndpoint {
 
    @Autowired
    private PartnersService partnersService;
   
    public VOSSAsyncNotificationEndpoint() {
                // TODO Auto-generated constructor stub
        }
 
    @PayloadRoot(namespace="http://127.0.0.1:8888/ws/webservices/8.1/asyncNotification/", localPart="transactionStatusNotification")
    public void transactionStatusNotification(@RequestPayload TransactionStatusResponse result) {
            System.out.println("Phase: " + result.getPhase());
        System.err.println("ExternalTransactionUUID: " + result.getExternalTransactionUUID());
    }
 
}


here is web.xml

Code:

       
<servlet>
        <servlet-name>spring-ws</servlet-name>
        <servlet-class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-class>
                <init-param>
                        <param-name>contextConfigLocation</param-name>
                        <param-value>/WEB-INF/spring-ws-servlet.xml</param-value>
                </init-param>
                <init-param>
            <param-name>transformWsdlLocations</param-name>
            <param-value>true</param-value>
        </init-param>
    </servlet>

    <servlet-mapping>
        <servlet-name>spring-ws</servlet-name>
        <url-pattern>/ws/*</url-pattern>
    </servlet-mapping>

here is spring config:

Code:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:context="http://www.springframework.org/schema/context"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:sws="http://www.springframework.org/schema/web-services"
        xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
      http://www.springframework.org/schema/web-services http://www.springframework.org/schema/web-services/web-services-2.0.xsd
      http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
        <context:component-scan base-package="com.blueoss.cis.ws" />
        <sws:annotation-driven />
        <!-- <sws:dynamic-wsdl id="asyncNotificationWS" portTypeName="asyncNotification"
                serviceName="transactionStatusNotification" locationUri="/ws_services/" targetNamespace="http://webservice.api.visionoss.com/v8_1/asyncNotification/"
                createSoap11Binding="true" requestSuffix="Response"> <sws:xsd location="/WEB-INF/asyncNotification.xsd"
                /> </sws:dynamic-wsdl> -->

        <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.xmlbeans.XmlBeansMarshaller">
        </bean>

        <bean id="asyncNotification-schema" class="org.springframework.xml.xsd.SimpleXsdSchema">
                <property name="xsd" value="/WEB-INF/wsdl/asyncNotification.xsd">
                </property>
        </bean>

        <sws:static-wsdl id="asyncNotification" location="/WEB-INF/wsdl/asyncNotification.wsdl" />

</beans>

and wsdl:

Code:

<?xml version='1.0' encoding='UTF-8'?><!-- Published by JAX-WS RI at http://jax-ws.dev.java.net.
        RI's version is JAX-WS RI 2.2.1-hudson-28-. -->
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
        xmlns:tns="http://webservice.api.visionoss.com/v8_1/asyncNotification/"
        xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:txn="http://v8_1.core.api.visionoss.com/transaction/" name="notificationWebService"
        targetNamespace="http://127.0.0.1:8888/ws/webservices/8.1/asyncNotification/">

        <wsdl:types>
                <xsd:schema
                        targetNamespace="http://127.0.0.1:8888/ws/webservices/8.1/asyncNotification/">
                        <xsd:import namespace="http://v8_1.core.api.visionoss.com/transaction/"
                                schemaLocation="syncNotification.xsd" />

                        <xsd:element name="transactionStatusResponse" type="txn:transactionStatusResponse" />
                </xsd:schema>
        </wsdl:types>

        <wsdl:message name="transactionStatusResponse">
                <wsdl:part element="tns:transactionStatusResponse" name="result" />
        </wsdl:message>

        <wsdl:portType name="asyncNotification">
                <wsdl:operation name="transactionStatusNotification">
                        <wsdl:input message="tns:transactionStatusResponse" />
                </wsdl:operation>
        </wsdl:portType>

        <wsdl:binding name="asyncNotificationSoap" type="tns:asyncNotification">
                <soap:binding style="document"
                        transport="http://schemas.xmlsoap.org/soap/http" />
                <wsdl:operation name="transactionStatusNotification">
                        <soap:operation soapAction="transactionStatusNotification" />
                        <wsdl:input>
                                <soap:body use="literal" />
                        </wsdl:input>
                </wsdl:operation>
        </wsdl:binding>

        <wsdl:service name="asyncNotification">
                <wsdl:port binding="tns:asyncNotificationSoap" name="asyncNotificationSoap">
                        <soap:address
                                location="http://127.0.0.1:8888/ws/webservices/8.1/asyncNotification" />
                </wsdl:port>
        </wsdl:service>

</wsdl:definitions>

I can open the wsdl file on http://127.0.0.1:8888/ws/webservices...ification.wsdl

but I get the following error on soapui:

Code:

Error loading [http://127.0.0.1:8888/ws/webservices/8.1/syncNotification.xsd]: org.apache.xmlbeans.XmlException: org.apache.xmlbeans.XmlException: error: Unexpected end of file after null
also if I try to open the xdd wit a post request I get:

Code:

500 Could not create message from InputStream: Invalid Content-Type:text/plain. Is this an error message instead of a SOAP response?; nested exception is com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Invalid Content-Type:text/plain. Is this an error message instead of a SOAP response?
can anyone help me please??

Thanks in advance.

Premature end of file in Webservice Template-Webservice client

$
0
0
Hi,
I am trying to invoke soap service using webservice client and I am geting a premature end of file exception. This is working fine from SOAP UI and sample java client. Below is the trace. I am not sure whether it is expecting any header.


org.springframework.ws.client.WebServiceIOExceptio n: I/O error: Unexpected end of file from server; nested exception is java.net.SocketException: Unexpected end of file from server
at org.springframework.ws.client.core.WebServiceTempl ate.sendAndReceive(WebServiceTemplate.java:543)
at org.springframework.ws.client.core.WebServiceTempl ate.doSendAndReceive(WebServiceTemplate.java:492)
at org.springframework.ws.client.core.WebServiceTempl ate.sendSourceAndReceiveToResult(WebServiceTemplat e.java:436)
at org.springframework.ws.client.core.WebServiceTempl ate.sendSourceAndReceiveToResult(WebServiceTemplat e.java:427)
at org.springframework.ws.client.core.WebServiceTempl ate.sendSourceAndReceiveToResult(WebServiceTemplat e.java:417)
at com.test.client.WebServiceClient.simpleSendAndRece ive(WebServiceClient.java:58)
at com.test.client.TestClient.testItemLookup1(TestCli ent.java:68)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.junit.runners.model.FrameworkMethod$1.runRefle ctiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallabl e.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExpl osively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod .evaluate(InvokeMethod.java:20)
at org.junit.internal.runners.statements.RunBefores.e valuate(RunBefores.java:28)
at org.junit.internal.runners.statements.RunAfters.ev aluate(RunAfters.java:31)
at org.junit.runners.BlockJUnit4ClassRunner.runChild( BlockJUnit4ClassRunner.java:73)
at org.junit.runners.BlockJUnit4ClassRunner.runChild( BlockJUnit4ClassRunner.java:46)
at org.junit.runners.ParentRunner.runChildren(ParentR unner.java:180)
at org.junit.runners.ParentRunner.access$000(ParentRu nner.java:41)
at org.junit.runners.ParentRunner$1.evaluate(ParentRu nner.java:173)
at org.junit.internal.runners.statements.RunBefores.e valuate(RunBefores.java:28)
at org.junit.internal.runners.statements.RunAfters.ev aluate(RunAfters.java:31)
at org.junit.runners.ParentRunner.run(ParentRunner.ja va:220)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestR eference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecutio n.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.main(RemoteTestRunner.java:197)
Caused by: java.net.SocketException: Unexpected end of file from server
at sun.net.http://www.http.HttpClient.parseHTTP...nt.jav a:774)
at sun.net.http://www.http.HttpClient.parseHTTP...ient.java:633)
at sun.net.http://www.http.HttpClient.parseHTTP...nt.jav a:771)
at sun.net.http://www.http.HttpClient.parseHTTP...ient.java:633)
at sun.net.http://www.protocol.http.HttpURLConn...ion.java:1195)
at java.net.HttpURLConnection.getResponseCode(HttpURL Connection.java:379)
at sun.net.http://www.protocol.https.HttpsURLCo...Impl.java:318)
at org.springframework.ws.transport.http.HttpUrlConne ction.getResponseCode(HttpUrlConnection.java:131)
at org.springframework.ws.transport.http.AbstractHttp SenderConnection.hasResponse(AbstractHttpSenderCon nection.java:64)
at org.springframework.ws.transport.AbstractSenderCon nection.createTransportInputStream(AbstractSenderC onnection.java:46)
at org.springframework.ws.transport.AbstractWebServic eConnection.receive(AbstractWebServiceConnection.j ava:86)
at org.springframework.ws.client.core.WebServiceTempl ate.doSendAndReceive(WebServiceTemplate.java:589)
at org.springframework.ws.client.core.WebServiceTempl ate.sendAndReceive(WebServiceTemplate.java:537)
... 30 more

Please Help! Exception:WebServiceTransportException: Not Found [404]

$
0
0
I can't seem to fix this Exception.

Here's the background.

I have a simple Spring WS Web Service that works.

I can use a tool like "POSTMAN" (plug-in to Chrome) and send this service XML requests. I then receive the correct XML Response back in POSTMAN.

All good so far.

YET....

When I try to use Spring's WebServiceTemplate, I get a 404 error on the response.

I set my defaultUri to the web service root (as I did with POSTMAN) and generated an XML Request. Note that I tested the XML Request generated in the WebServiceTemplate code and it returns a correct response in POSTMAN).

However, calling the webServiceTemplate.sendSourceAndReceiveToResult(so urce, result) call below
(Note: This Forum seems to be putting a space in the word "source" above that is not in the code)

ClientLogMessageHandler[] handler = new ClientLogMessageHandler[1];
handler[0] = new ClientLogMessageHandler();
WebServiceTemplate webServiceTemplate = new WebServiceTemplate();
webServiceTemplate.setDefaultUri
("http://localhost:8080/myService/"); // exactly what was entered in POSTMAN in Chrome.

System.out.println("------- webServiceTemplate ----------" + webServiceTemplate
.getDefaultUri());

String requestXML = createRequestXML();
Source source = new StringSource(requestXML); // Request XML here exactly what works in POSTMAN.
Result result = new StringResult();
webServiceTemplate.sendSourceAndReceiveToResult(so urce,result);
(Note: This Forum seems to be putting a space in the word "source" above that is not in the code)

System.out.println("--------- result --------" + result.toString());

********************************
Results in this confusing Error Stack:
********************************

org.springframework.ws.client.WebServiceTransportE xception: Not Found [404]
at org.springframework.ws.client.core.WebServiceTempl ate.handleError(WebServiceTemplate.java:622)
at org.springframework.ws.client.core.WebServiceTempl ate.doSendAndReceive(WebServiceTemplate.java:546)
at org.springframework.ws.client.core.WebServiceTempl ate.sendAndReceive(WebServiceTemplate.java:496)
at org.springframework.ws.client.core.WebServiceTempl ate.doSendAndReceive(WebServiceTemplate.java:451)
at org.springframework.ws.client.core.WebServiceTempl ate.sendSourceAndReceiveToResult(WebServiceTemplat e.java:395)
at org.springframework.ws.client.core.WebServiceTempl ate.sendSourceAndReceiveToResult(WebServiceTemplat e.java:386)
at org.springframework.ws.client.core.WebServiceTempl ate.sendSourceAndReceiveToResult(WebServiceTemplat e.java:376)
at myServiceClient.invokeService(myServiceClient.java :49)
at myServiceClient.main(myServiceClient.java:25)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.intellij.rt.execution.application.AppMain.main (AppMain.java:120)


***********
***********

The referenced "myServiceClient" lines in the error stack above is just where it's calling the web service. Not helpful.

I'm baffled. There are many confused people who have left postings I've found on the Internet on this exact problem, but no solutions.

I've tried using a different version of the Spring libs, but that didn't work.

As many have posted, this problem seems nearly debug-proof. I've spent several days trying to figure out what Spring wants.

Any suggestions would be most welcome.

Thanks,

Create a SOAP message from a file

$
0
0
Hi,

I am trying to have my message factory (Axiom) create a SOAP message by reading a file.
This is my code:

Code:

File messageFile = new ClassPathResource(messageFileName).getFile();
FileInputStream messageStream = new FileInputStream(messageFile);
WebServiceMessageFactory messageFactory =
                        (WebServiceMessageFactory) getApplicationContext().getBean("messageFactory");
WebServiceMessage message = messageFactory.createWebServiceMessage(messageStream);

However, I get an exception:

Code:

AxiomSoapMessageFactory requires a TransportInputStream. Object of class [java.io.FileInputStream] must be an instance of class org.springframework.ws.transport.TransportInputStream
What do I need to do to get this to work? What concrete classes extend TransportInputStream?
Or do I need to implement my own?

Thanks.

spring + axis2 :: reading parameters

$
0
0
Hi,
I've been using Spring + axis2 inorder to develop bunch of webservices for a while, and I was wondering if there's a way to read (axis) Parameters in my code.
( MessageContext.getCurrentMessageContext().getParam eter... will cause NullPointerException 'cuz the MessageContext.getCurrentMessageContext always returns nulll )
thanks in advance :)

Spring REST and Entity resolution

$
0
0
Hi all,

I have done several tests using a sample SPring based REST application and unmarshalling XML messages with Spring OXM through the RequestBody annotations. I found out that if SpringOXM is using JAXB or Castor (I did not try the rest) the default unmarshalling behaviour is to resolve external entities and so it makes every single Spring based REST api vulnerable to Xml External Entity injection. I tried to set up the underlying parser to disable entity resolution but I could not. It seems theres no way to do it with JAXB and Castor has a new property exposed through the Spring OXM castorMarshaller that allows to set a entity resolver. But setting it to null does not change the behaviour.
So before openeing a bug for this, I preferred to ask the forum just in case Im not aware of a way to disable entity resolution. Is there any?

Thanks,
A

Specifying encoding for web service client

$
0
0
Hello,

I am new to WS. Basically, instead of UTF-8 I need to send a message with <?xml version="1.0" encoding="ISO-8859-1"?>

I am building my xml message using groovy.xml.MarkupBuilder and using WebServiceTemplate to send.

For the outgoing SOAP XML, can I specify the encoding for the outgoing message when I develop client application with Spring Web-service?

Thanks in advance..

Ekrem

Here is my code:

class RequestSender {

@Autowired
WebServiceTemplate webServiceTemplate

public def send(def request, String url) {

String decodedResponse

//request is xml message that is build by groovy.xml.MarkupBuilder

try {
String requestValue = request.bytes.encodeBase64().toString()

def writer = new StringWriter()
def xml = new MarkupBuilder(writer)
xml.Message() {
Request(xmlns: "", requestValue)
}

SoapActionCallback soapActionCallback = new SoapActionCallback("${url}/Message") {
public void doWithMessage(WebServiceMessage msg) {
SoapMessage smsg = (SoapMessage)msg
smsg.setSoapAction("${url}/Message")
}
}

DOMResult result = new DOMResult()
StreamSource source = new StreamSource(new StringReader(writer.toString()))

webServiceTemplate.sendSourceAndReceiveToResult("$ {url}", source, soapActionCallback, result)

Element responseElement = (Element) result.getNode().getFirstChild()
String response = responseElement.firstChild.firstChild.data
decodedResponse = new String(response.decodeBase64())

} catch (Exception e) {}

return decodedResponse
}
}

Libs used:
spring-ws-core:2.1.3.RELEASE
spring-ws:2.1.3.RELEASE

WebServiceTemplate - Get it to stop adding SOAP Envelope?

$
0
0
Is it possible to use WebServiceTemplate, but have it NOT add the SOAP envelope around the XML Request going to the Spring WS Web Service?

Because our Spring WS Webservice only uses RAW XML, Web Service Template always returns a "404" error since our dynamically generated method call in our Endpoint class has no idea what the SOAP header is all about and can't route it. Our Web Service just expects the RAW XML Request itself with no SOAP Header.

Our service works fine with POSTMAN and other tools, but, sadly, not yet with WebServiceTemplate.

We're looking for a way to test our Spring-WS XML (only) Web Service, but neither SOAP UI nor WebServiceTemplate seem to work since we don't use SOAP at all.

Workarounds, suggestions???

Thanks,

-m

Apam

$
0
0
The Recovery of the Starch Loss And Grain Stillage From A Starch Plant and AN Alcohol Plant
If the PAM-H-2 is added into the waste water from the starch plant, the starch grains will be flocculated to sediment. Then this sediment is through the filter-pressing process by a pressure filter, caked and used as feedstuff. The grain stillage from an alcohol pant can also be dewatered by the PAM-H-4 and recovered through the filter-pressing process.

Rutile Titanium Dioxide
Rutile Titanium Dioxide R218 is produced by Sulphate Process, with high dispersibility, super durability, high opacity and stability
Application:
Rutile Grade R 218 is widely used in Paint & Coating, Plastic, Ink and Paper industries.
Viewing all 278 articles
Browse latest View live