You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by "Mathias P.W Nilsson" <ma...@snyltarna.se> on 2007/08/28 11:05:02 UTC

invoke webservices and doubt on structure

Hi!

I'm a newbe to Webservices and I want my webapplication to expose
webservices for applets, php etc.
I have embeded Axis2 in my webapplication by using this tutorial. when
quering ?wsdl and ?xsd I get a response but how can I make a client to query
the webservice?

I've tried wsdl2java but the code was 1000 rows? I thought I could invoke my
webservice using 10?

here is the link to the tutorial.  http://wso2.org/library/90 Books link 

There are many questions about this:
How can I invoke from a client using minimal code?
the server.xml is in the services/bookservice/META-INF folder. Must every
webservice have it's own structure like this. If I have 100 webservices it
would meen 100 folders, 100 meta-inf and 100 services? I must be missing
something

// Mathias
-- 
View this message in context: http://www.nabble.com/invoke-webservices-and-doubt-on-structure-tf4340541.html#a12364433
Sent from the Axis - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: invoke webservices and doubt on structure

Posted by "Mathias P.W Nilsson" <ma...@snyltarna.se>.
Can this be done with embedded Axis2? I can't get it to work, and I can't get
a client to work either.

Here are some code

The Service

----------------------------------------------
package samples.demo;

/**
 * @author  mailto:dan@envoisolutions.com Dan Diephouse 
 */
public class BookService{
    private Book onlyBook;

    public BookService() {
        onlyBook = new Book();
        onlyBook.setAuthor("Dan Diephouse");
        onlyBook.setTitle("Using Axis2");
        onlyBook.setIsbn("0123456789");
    }

    public Book[] getBooks() {
        return new Book[]{onlyBook};
    }

    public Book findBook(String isbn) {
        if (isbn.equals(onlyBook.getIsbn()))
            return onlyBook;

        return null;
    }
}
----------------------------------------------

The book class
----------------------------------------------
package samples.demo;

/**
 * @author  mailto:dan@envoisolutions.com Dan Diephouse 
 */
public class Book {
    private String title;
    private String isbn;
    private String author;

    public String getIsbn() {
        return isbn;
    }

    public void setIsbn(String isbn) {
        this.isbn = isbn;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }
}
----------------------------------------------

The structure looks like this
webapp/WEB-INF/services/BookService/META-INF/services.xml


Here is the service xml

----------------------------------------------
<serviceGroup>
	<service name="BookService"
             targetNamespace="http://ws.apache.org/axis2/samples/book/">
		<description>
			Book sample service
		</description>
        <schema
schemaNamespace="http://ws.apache.org/axis2/samples/book/xsd/"/>
        <parameter name="ServiceClass"
locked="false">samples.demo.BookService</parameter>
		<operation name="getBooks">
			<messageReceiver
class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
		</operation>
        <operation name="findBook">
            <messageReceiver
class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
        </operation>
	</service>
</serviceGroup>

----------------------------------------------

I've added the Axis Servlet to my web.xml 

Any ideas?

-- 
View this message in context: http://www.nabble.com/invoke-webservices-and-doubt-on-structure-tf4340541.html#a12366601
Sent from the Axis - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: invoke webservices and doubt on structure

Posted by Andrew Martin <am...@regenstrief.org>.

Mathias P.W Nilsson wrote:
> Hi!
> 
> I'm a newbe to Webservices and I want my webapplication to expose
> webservices for applets, php etc.
> I have embeded Axis2 in my webapplication by using this tutorial. when
> quering ?wsdl and ?xsd I get a response but how can I make a client to query
> the webservice?
> 
> I've tried wsdl2java but the code was 1000 rows? I thought I could invoke my
> webservice using 10?
> 
> here is the link to the tutorial.  http://wso2.org/library/90 Books link 
> 
> There are many questions about this:
> How can I invoke from a client using minimal code?
> the server.xml is in the services/bookservice/META-INF folder. Must every
> webservice have it's own structure like this. If I have 100 webservices it
> would meen 100 folders, 100 meta-inf and 100 services? I must be missing
> something

You can have multiple services in a single directory.  You can define
more than one service in your services.xml file:
<serviceGroup>
	<service name="Service1">
		<parameter name="ServiceClass">org.myorg.MyClass</parameter>
		<operation name="Service1">
			<messageReceiver
class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
		</operation>
	</service>
	<service name="Service2">
		<parameter name="ServiceClass">org.myorg.MyOtherClass</parameter>
		<operation name="Service2">
			<messageReceiver
class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
		</operation>
	</service>
</serviceGroup>

Andrew

> // Mathias

-- 
Andrew Martin
Computer Programmer
Regenstrief Institute, Inc.
410 West 10th Street, Suite 2000
Indianapolis, IN 46202-3012
Phone: (317) 423-5542
Fax: (317) 423-5695
amartin@regenstrief.org


Confidentiality Notice: The contents of this message and any files
transmitted with it may contain confidential and/or privileged
information and are intended solely for the use of the named
addressee(s). Additionally, the information contained herein may have
been disclosed to you from medical records with confidentiality
protected by federal and state laws. Federal regulations and State laws
prohibit you from making further disclosure of such information without
the specific written consent of the person to whom the information
pertains or as otherwise permitted by such regulations. A general
authorization for the release of medical or other information is not
sufficient for this purpose.

If you have received this message in error, please notify the sender by
return e-mail and delete the original message. Any retention,
disclosure, copying, distribution or use of this information by anyone
other than the intended recipient is strictly prohibited.

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org