Results 1 to 2 of 2
  1. #1
    njitram is offline Member
    Join Date
    Jun 2010
    Posts
    4
    Rep Power
    0

    Default Java SOAP Listener

    Hello all!

    At this moment im trying to parse Data from my website to a server, so i was thinking of building a SOAP application.

    Im searching the web for some kind of listener but i can i find allot of clients but no listeners? any idea which website / sample i can use?

    Many Thanks in advance!

    Greetz
    Martijn

  2. #2
    njitram is offline Member
    Join Date
    Jun 2010
    Posts
    4
    Rep Power
    0

    Default

    Oke now i have found this one:

    Java Code:
    package Listener;
    
    import javax.jws.WebService;
    import javax.jws.soap.SOAPBinding;
    import javax.jws.soap.SOAPBinding.Style;
    import javax.xml.ws.Endpoint;
    
    @WebService
    public class listener {
    	@SOAPBinding(style = Style.RPC)
    	public String getQuote(String category) {
    		if (category.equals("fun")) {
    			return "5 is a sufficient approximation of infinity.";
    		} else if (category.equals("work")) {
    			return "Remember to enjoy life, even during difficult situatons.";
    		} else {
    			return "Becoming a master is relatively easily. Do something well and then continue to do it for the next 20 years";
    		}
    	}
    
    	public static void main(String[] args) {
    		listener server = new listener();
    		Endpoint endpoint = Endpoint.publish(
    				"http://localhost:9191/test", server);
    	}
    }
    When i go to : http://localhost:9191/test?wsdl it shows me:
    Java 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.1.6 in JDK 6. --><!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.6 in JDK 6. --><definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://Listener/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://Listener/" name="listenerService">
    <types></types>
    <message name="getQuote">
    <part name="arg0" type="xsd:string"></part>
    </message>
    <message name="getQuoteResponse">
    <part name="return" type="xsd:string"></part>
    </message>
    <portType name="listener">
    <operation name="getQuote">
    <input message="tns:getQuote"></input>
    <output message="tns:getQuoteResponse"></output>
    </operation>
    </portType>
    <binding name="listenerPortBinding" type="tns:listener">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc"></soap:binding>
    <operation name="getQuote">
    
    <soap:operation soapAction=""></soap:operation>
    <input>
    <soap:body use="literal" namespace="http://Listener/"></soap:body>
    </input>
    <output>
    <soap:body use="literal" namespace="http://Listener/"></soap:body>
    </output>
    </operation>
    </binding>
    <service name="listenerService">
    <port name="listenerPort" binding="tns:listenerPortBinding">
    <soap:address location="http://localhost:9191/test"></soap:address>
    </port>
    </service>
    </definitions>
    Seems fine right?

    I have tryed to access it with PHP but i can't manage it..? i have no reason why this isn't working:

    PHP Code:
    <?php
    ini_set("soap.wsdl_cache_enabled","0");
    
    $client = new soapclient( "http://localhost:9191/test?wsdl" );
    
    // Check for an error
    $err = $client->getError();
    if ($err)
    	echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
    
    print_r( $client->getQuote('fine') );
    
    // Debugger
    echo '<h2>Request</h2>';
    echo '<pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
    echo '<h2>Response</h2>';
    echo '<pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
    // Display the debug messages
    echo '<h2>Debug</h2>';
    echo '<pre>' . htmlspecialchars($client->debug_str, ENT_QUOTES) . '</pre>'; 
    ?>
    Error:
    Fatal error: Maximum execution time of 60 seconds exceeded in C:\xampp\htdocs\wsdl\wsdl.php on line 0

    This should be very fast cause its localhost there are no security messures etc.


    Can any one give me some solutions or tips?
    Last edited by njitram; 01-29-2011 at 11:08 PM.

Similar Threads

  1. SOAP RPC Java Client
    By _SolidSnake_ in forum Advanced Java
    Replies: 0
    Last Post: 01-19-2011, 12:00 PM
  2. Migrating Java SOAP app. Help please
    By Fortunato in forum Advanced Java
    Replies: 2
    Last Post: 11-01-2010, 10:20 PM
  3. Replies: 1
    Last Post: 10-25-2010, 07:54 PM
  4. Java GForge SOAP Interface 0.0.7
    By JavaBean in forum Java Software
    Replies: 0
    Last Post: 07-09-2007, 05:41 PM
  5. Java GForge SOAP Interface 0.0.4
    By JavaBean in forum Java Software
    Replies: 0
    Last Post: 06-26-2007, 10:50 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •