I have a service, its really just a simple bean pattern:
public class StatefulService
{
private String value;
public void setValue(String value)
{
this.value = value;
}
public String getValue()
{
return this.value;
}
}
I am having a hard time figuring out what you would do from the client
side to use the "getValue" method of the service, it produces the
following wsdl operation:
<wsdl:operation name="getValue">
<wsdlsoap:operation soapAction="" />
<wsdl:input name="getValueRequest">
<wsdlsoap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://meis/mailservlet/" use="encoded" />
</wsdl:input>
<wsdl:output name="getValueResponse">
<wsdlsoap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://meis/mailservlet/" use="encoded" />
</wsdl:output>
</wsdl:operation>
I tried this:
call.setOperationName( new QName("StatefulService",
"getValue") );
//why do I have to do this?
call.addParameter( "testval", XMLType.XSD_ANY,
ParameterMode.IN);
call.setReturnType(
org.apache.axis.encoding.XMLType.XSD_STRING);
//why does invoke require an object array if there are
no parameters?
//shouldn't there be an overloaded method with no
parameters?
String ret = (String)call.invoke( new Object[] { null } );
But it doesn't work, I can't find any services without parameters in the
examples, any ideas?
-----------------------------------------
Clay Graham
President
newObjectivity, Inc.
making the mobile-world-office
http://www.newobjectivity.com/
-----Original Message-----
From: Clay Graham [mailto:[EMAIL PROTECTED]
Sent: Friday, April 04, 2003 10:13 AM
To: [EMAIL PROTECTED]
Subject: RE: Stateful web services.
This has been filed as bug# 18718
Hope it helps!
-----------------------------------------
Clay Graham
President
newObjectivity, Inc.
making the mobile-world-office
http://www.newobjectivity.com/
-----Original Message-----
From: Davanum Srinivas [mailto:[EMAIL PROTECTED]
Sent: Thursday, April 03, 2003 5:44 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: Stateful web services.
See directions for patches at
http://nagoya.apache.org/wiki/apachewiki.cgi?AxisProjectPages/SubmitPatc
hes
--- Clay Graham <[EMAIL PROTECTED]> wrote:
> Absolutely.
>
> I am not real familiar with the development process of axis, but I am
> more than willing to try!
>
> What I will try to do is make a nice package based on the existing
> docs, and then submit it (where?).
>
>
>
> -----------------------------------------
> Clay Graham
> President
> newObjectivity, Inc.
> making the mobile-world-office
> http://www.newobjectivity.com/
>
>
>
> -----Original Message-----
> From: Tom Jordahl [mailto:[EMAIL PROTECTED]
> Sent: Thursday, April 03, 2003 1:50 PM
> To: '[EMAIL PROTECTED]'
> Subject: RE: Stateful web services.
>
>
>
> Clay,
>
> This is great. Do you think you could check out the current Axis HTML
> docs and see if you can put together a patch that would integrate this
> in to it?
>
> Your code could just be new files in the samples directory.
>
> If you could do that, then put the info in a Bugzilla report, that
> would increase the chances that someone (me) would check it in to the
> tree for others.
>
> --
> Tom Jordahl
> Macromedia Server Development
>
> -----Original Message-----
> From: Clay Graham [mailto:[EMAIL PROTECTED]
> Sent: Thursday, April 03, 2003 3:22 PM
> To: [EMAIL PROTECTED]
> Subject: RE: Stateful web services.
>
> [SOLUTION]
>
> I am including the full solution because I think this is the type of
> thing everybody wants....
>
> #####################################################################
>
> 1. Create your service
>
> /*
> * NOIMailService.java
> *
> * Created on April 2, 2003, 5:19 PM
> */
>
> package com.noi.mailservlet.web.services;
> import javax.activation.*;
> import java.util.*;
> import javax.ejb.*;
> import javax.mail.*;
> import javax.mail.internet.*;
> import javax.mail.search.*;
> import java.io.*;
>
> /**
> *
> * @author clay
> */
> public class NOIMailService {
>
> /** Holds value of property username. */
> private String username;
>
> /** Holds value of property password. */
> private String password;
>
> /** Holds value of property hostname. */
> private String hostname;
>
> private boolean connected;
>
> /** Holds value of property protocol. */
> private String protocol;
>
> private static final String loginmbox = "INBOX";
>
> private Store store;
> private Session session;
> private URLName url;
>
> /** Creates a new instance of NOIMailService */
> public NOIMailService() {
> this.connected = false;
> this.protocol = "imap";
> }
>
>
> public boolean login(String protocol, String username, String
> password, String hostname)
> {
>
> this.protocol = protocol;
> this.username = username;
> this.password = password;
> this.hostname = hostname;
>
> try{
> url = new URLName(
> this.protocol,
> this.hostname,
> -1,
> this.loginmbox,
> this.username,
> this.password);
>
> Properties props = System.getProperties();
>
> if (hostname != null)
> props.put("mail.smtp.host", this.hostname);
> else if (props.getProperty("mail.smtp.host") == null)
> props.put("mail.smtp.host", "localhost");
>
> this.session = Session.getDefaultInstance(props, null);
> this.session.setDebug(true);
>
> PasswordAuthentication pw = new
> PasswordAuthentication(url.getUsername(), this.url.getPassword());
> this.session.setPasswordAuthentication(url, pw);
>
> this.store = this.session.getStore(url);
> this.store.connect();
> this.connected = true;
> return this.connected;
> }
> catch(Exception e)
> {
> this.connected = false;
> return this.connected;
> }
>
> }
>
> public boolean isConnected()
> {
> return this.connected;
> }
>
> public boolean sendStatelessMessage(String protocol, String
> username, String password, String hostname, String to, String cc,
> String bcc, String subject, String body)
> {
> if(this.login(protocol, username, password, hostname))
> {
> try {
>
> Message msg = new MimeMessage(this.session);
>
> //to
> InternetAddress[] toAddrs = null;
> if ((to != null) && !to.equals("")) {
> toAddrs = InternetAddress.parse(to, false);
> msg.setRecipients(Message.RecipientType.TO,
> toAddrs);
> }
> else
> return false;
>
>
> //sent date
> msg.setSentDate(Calendar.getInstance().getTime());
>
> //from
> String fromAddress = url.getUsername() +
> "@"+url.getHost();
> msg.setFrom(new InternetAddress(fromAddress));
>
> //cc
> InternetAddress[] ccAddrs = null;
> if ((cc != null) && !cc.equals("")) {
> ccAddrs = InternetAddress.parse(cc, false);
> msg.setRecipients(Message.RecipientType.CC,
> ccAddrs);
> }
>
> InternetAddress[] bccAddrs = null;
> if ((bcc != null) && !bcc.equals("")) {
> bccAddrs = InternetAddress.parse(bcc, false);
> msg.setRecipients(Message.RecipientType.BCC,
> toAddrs);
> }
>
> //subject
>
=== message truncated ===
=====
Davanum Srinivas - http://webservices.apache.org/~dims/
__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more
http://tax.yahoo.com