Announcement Announcement Module
Collapse
No announcement yet.
Unable to consume from SOAP WS - Spring 3/Spring-WS Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Unable to consume from SOAP WS - Spring 3/Spring-WS

    Hi guys, glad to know of this community.... I'm figure out how to use Spring Web Services with Spring 3 and Jboss 5.
    I have multiple soap web services made by the eclipse wizard (you know, right click next next next...) tested with classic clients (SOAPui, dynamic web projects, etc), all working well.. The thing is that i can't figure out how to use Spring Web Service libraries with WSDL URIs. (btw can't use the classic web service client method because a strange no-ending loop).

    Sorry if I sound a little bit basic with questions, i'm not experienced that much with WS in general but I know the basics.

    I'm following this guide:
    http://static.springsource.org/sprin...ml/client.html

    i'm trying to adapting my project:

    this is part of my application context file
    Code:
        <bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory"/>
    	
        <bean id="webServiceTemplate" class="org.springframework.ws.client.core.WebServiceTemplate">
            <constructor-arg ref="messageFactory"/>
            <property name="defaultUri" value="http://localhost:8080/TestWS/services/ConsultaWS"/>
        </bean>
    here is my web service template class
    Code:
    package cl.fal.connect.ws;
    
    import java.io.StringReader;
    import javax.xml.transform.stream.StreamResult;
    import javax.xml.transform.stream.StreamSource;
    
    import org.springframework.ws.client.core.WebServiceTemplate;
    
    
    public class WebServiceClient {
    
        private static final String MESSAGE = "<message xmlns=\"http://tempuri.org\">Hello Web Service World</message>";
    
        private final WebServiceTemplate webServiceTemplate = new WebServiceTemplate();
    
        public void setDefaultUri(String defaultUri) {
            webServiceTemplate.setDefaultUri(defaultUri);
        }
    
        // send to the configured default URI
        public void simpleSendAndReceive() {
            StreamSource source = new StreamSource(new StringReader(MESSAGE));
            StreamResult result = new StreamResult(System.out);
            webServiceTemplate.sendSourceAndReceiveToResult(source, result);
        }
    
    }
    and this is my test class..
    Code:
    package cl.fal.connect.ws;
    
    public class Test {
    	
    	public static void main(String args[]){
    		hello();
    	}
    	
    	public static void hello(){
    		WebServiceClient w = new WebServiceClient();
    		w.setDefaultUri("http://localhost:8080/TestWS/services/ConsultaWS");
    		w.simpleSendAndReceive();
    	}
    }
    I get this error: "java.lang.UnsupportedOperationException: setProperty must be overridden by all subclasses of SOAPMessage at javax.xml.soap.SOAPMessage.setProperty(Unknown Source).

    Also I have a web method that has 2 parameters and returns a String value, can't figure out either how to call my webmethod from a WSDL URI

    i'm using Spring 3.0.1, Spring-WS 2.0.4, Axis 1.4 and Jboss 5.1.0

    hope you help me out...

  • #2
    bump... anyone???

    Comment

    Working...
    X