Not sure if attaching files works for this mailing list so I'm posting everything in the email. My service uses https so TCPmon won't work. I tried connecting via http instead and got an exception that said the expected transport is https, probably because I'm using rampart. Don't really want to get into fixing that now since my service is always going to use https anyway. I am using Axis2 1.5.5.
Here is the client code that makes the request (I'm not including the generated stub) CashcardserviceStub. Transaction tr = new CashcardserviceStub.Transaction(); tr.setAmount(1000); tr.setOtherAcct(1004); tr.setDate(System.currentTimeMillis()); tr.setPending(true); tr.setTransID(1); SyncTransaction request4 = new CashcardserviceStub.SyncTransaction(); request4.setT(tr); stub.syncTransaction(request4); Here is the server code (note that the syncTransaction method is empty for now, since it's not even getting to that point. If I put a break point in the method it never reaches it) package cashcard.server; import java.io.IOException; import java.util.logging.FileHandler; import java.util.logging.Logger; import org.apache.axis2.AxisFault; import org.apache.axis2.context.MessageContext; import org.apache.rampart.RampartMessageData; import cashcard.data.*; public class CashcardServer { private static String logfile = "C:\\Java\\apache-tomcat-7.0.14\\logs\\cashcard.log"; private static Logger logger = Logger.getLogger("cashcard.server"); private FileHandler fh; private SQLInterface si; public CashcardServer() { si = new SQLInterface(); try { fh = new FileHandler(logfile, true); logger.addHandler(fh); } catch (SecurityException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } public Account getAccount(int accountNo) throws AxisFault { try { si.connect(); return si.getAccount(accountNo); } catch (Exception e) { logger.severe(e.getMessage()); e.printStackTrace(); throw new AxisFault("Error getting account: " + e.getMessage()); } finally {si.disconnect();} } public Transaction[] getAccountTransactions(int accountNo) throws AxisFault { try { si.connect(); return si.getAccountTransactions(accountNo); } catch (Exception e) { logger.severe(e.getMessage()); e.printStackTrace(); throw new AxisFault("Error getting transactions: " + e.getMessage()); } finally {si.disconnect();} } public AccountNameMap getAccountNames(int[] accountNums) throws AxisFault { try { si.connect(); AccountNameMap accountNames = si.getAccountNames(accountNums); return accountNames; } catch (Exception e) { logger.severe(e.getMessage()); e.printStackTrace(); throw new AxisFault("Error getting account: " + e.getMessage()); } finally {si.disconnect();} } public void doCardTransaction(int amount) throws AxisFault { try { int accountNo = getCurrentAccountNum(); si.connect(); si.doCardTransaction(accountNo, amount); } catch (Exception e) { logger.severe(e.getMessage()); e.printStackTrace(); throw new AxisFault("Error getting account: " + e.getMessage()); } finally {si.disconnect();} } // public void syncTransaction(int transID, int otherAccountNo, int amount, long date, boolean isPending) throws AxisFault { // System.out.println("syncing"); // //Transaction[] transactions = new Transaction[]{}; // try { // si.connect(); // int accountNo = getCurrentAccountNum(); // si.addPendingTransaction(accountNo, transID, otherAccountNo, amount, date, isPending); // } catch (Exception e) { // logger.severe(e.getMessage()); // throw new AxisFault("Error getting account: " + e.getMessage()); // } // finally {si.disconnect();} // } public void syncTransaction(Transaction t) { } private int getCurrentAccountNum() throws AxisFault { MessageContext msgContext = MessageContext.getCurrentMessageContext(); String accountNoString = (String)msgContext.getProperty(RampartMessageData.USERNAME); try {return Integer.valueOf(accountNoString);} catch (NumberFormatException e) {throw new AxisFault("Invalid account No");} } } Here is my services.xml. I've read that i don't need to declare every method here, since Axis2 is supposed to automatically make every public method from the service available, but this doesn't work for me. They only work if I declare the operations here. <service> <module ref="rampart"/> <parameter name="ServiceClass" locked="false">cashcard.server.CashcardServer</parameter> <operation name="getAccount"> <messageReceiver class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/> </operation> <operation name="getAccountTransactions"> <messageReceiver class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/> </operation> <operation name="getAccountNames"> <messageReceiver class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/> </operation> <operation name="doCardTransaction"> <messageReceiver class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/> </operation> <operation name="syncTransaction"> <messageReceiver class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/> </operation> <wsp:Policy wsu:Id="UsernameTokenOverHTTPS" xmlns:wsu=" http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"> <wsp:ExactlyOne> <wsp:All> <sp:TransportBinding xmlns:sp=" http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"> <wsp:Policy> <sp:TransportToken> <wsp:Policy> <sp:HttpsToken RequireClientCertificate="false"/> </wsp:Policy> </sp:TransportToken> <sp:AlgorithmSuite> <wsp:Policy> <sp:Basic256/> </wsp:Policy> </sp:AlgorithmSuite> <sp:Layout> <wsp:Policy> <sp:Lax/> </wsp:Policy> </sp:Layout> <sp:IncludeTimestamp/> </wsp:Policy> </sp:TransportBinding> <sp:SignedSupportingTokens xmlns:sp=" http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"> <wsp:Policy> <sp:UsernameToken sp:IncludeToken=" http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient" /> </wsp:Policy> </sp:SignedSupportingTokens> <ramp:RampartConfig xmlns:ramp=" http://ws.apache.org/rampart/policy"> <ramp:passwordCallbackClass>cashcard.server.PWCBHandler</ramp:passwordCallbackClass> </ramp:RampartConfig> </wsp:All> </wsp:ExactlyOne> </wsp:Policy> </service> On Fri, Jul 22, 2011 at 10:01 PM, Sagara Gunathunga < sagara.gunathu...@gmail.com> wrote: > This should work without any problem. Can you provide your service > side, client side codes together with a SOAP messages so that we can > look into your problem ? Also what is your Axis2 version ? > > You can trace SOAP messages using a tool like TCPMon. > > Thanks ! > > On Sat, Jul 23, 2011 at 7:17 AM, Louis Amstutz <loui...@gmail.com> wrote: > > I am able to return custom objects from a webservice, but not send them > as > > parameters I get an Instantiation Exception when if a method in the > service > > has a parameter that is a custom object that I defined. I have no > problems > > with parameters that are simple data types like int or standard Java > objects > > like String. These custom class only have basic Java data types (int, > > String, boolean). > > > > Now the client stub defines it's own versions of my custom classes, but > to > > my understanding these should map correctly to the original classes on > the > > server. > > > > -- > Sagara Gunathunga > > Blog - http://ssagara.blogspot.com > Web - http://people.apache.org/~sagara/ > LinkedIn - http://www.linkedin.com/in/ssagara > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@axis.apache.org > For additional commands, e-mail: java-user-h...@axis.apache.org > >