[mule-user] Testing multiple parameters to mule axis service Mule 1.4.1

29 views
Skip to first unread message

dhenton

unread,
Sep 5, 2007, 5:51:46 PM9/5/07
to us...@mule.codehaus.org

At the bottom of this post is the full error message that I am getting but it
basically says
faultString: javax.xml.rpc.JAXRPCException: Number of parameters passed in
(1) doesn't match the number of IN/INOUT parameters (2) from the
addParameter() calls

which I interpret to say that I am only sending in one parameter, not two. I
got the idea of using the map from a posting here, but it doesn't seem to
work.

Also grepping source for 'treatMapAsNamedParams' which is a parameter that
can be set on the axis connector, doesn't turn anything up.

In short, can anyone give me some info on how to pass multiple parameters to
a Mule soap service when they are different types, I can do this when the
service requires multiples of the SAME type, but not different types.
Passing in an array of strings works great for a service that needs only
strings.

Thanks in Advance!!!!

This is my config file:


<mule-configuration id="axis_test" version="1.0">


<description>
Trying out mule as a soap server with multiple parameters passed in.
</description>


<connector name="axisConnector"
className="org.mule.providers.soap.axis.AxisConnector">
<properties>
<property name="treatMapAsNamedParams" value="true" />
</properties>
</connector>


<interceptor-stack name="default">
<interceptor className="org.mule.interceptors.LoggingInterceptor"/>
<interceptor className="org.mule.interceptors.TimerInterceptor"/>
</interceptor-stack>





<model name="test">

<mule-descriptor name="mycomponent1"
implementation="foo.bar.mule.MultipleParams">
<inbound-router>
<endpoint address="vm://mycomponent1"/>
</inbound-router>
<outbound-router>
<router
className="org.mule.routing.outbound.OutboundPassThroughRouter">
<endpoint
address="axis:http://localhost:2955/services/SoapTalkInterface?wsdl&amp;method=getGreetings"
synchronous="true">


</endpoint>
</router>
</outbound-router>
</mule-descriptor>



<mule-descriptor name="SoapTalkInterface"
implementation="foo.bar.mule.SoapSample">
<inbound-router>
<endpoint synchronous="true" name="SoapTest"
address="axis:http://localhost:2955/services/">

<properties>
<map name="soapMethods">
<list name="getGreetings">
<entry value="in0;string;in"/>
<entry value="in1;int;in"/>
<entry
value="getGreetingsReturn;string;out"/>
</list>
</map>
</properties>


</endpoint>
</inbound-router>
<interceptor name="default"/>
</mule-descriptor>





</model>
</mule-configuration>

This is my main class --------------------------------------

/*
* MuleMain.java
*
* Created on September 3, 2007, 9:28 AM
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/

package foo.bar;

import org.mule.config.ConfigurationException;
import org.mule.config.builders.MuleXmlConfigurationBuilder;
import org.mule.extras.client.MuleClient;
import org.mule.impl.MuleMessage;
import org.mule.umo.UMOException;
import org.mule.umo.UMOMessage;
import org.mule.umo.manager.UMOManager;
import java.util.*;

/**
*
* @author dyh
*/
public class MuleMain {

/** Creates a new instance of MuleMain */
public MuleMain() {
}
MuleClient client = null;

public void doLaunch() {
try {

MuleXmlConfigurationBuilder builder = new
MuleXmlConfigurationBuilder();
MuleClient client = new MuleClient("soaptalk.xml",builder);


Map mm = new HashMap();

mm.put("in0","Barney");
mm.put("in1",new Integer(55));

UMOMessage sendMessage = new MuleMessage(mm);

UMOMessage uM = client.send("vm://mycomponent1",
sendMessage,3000);
String tt = uM.getPayload().toString();
System.out.println(tt);


System.out.println("ending");



} catch (ConfigurationException ex) {
ex.printStackTrace();
} catch (UMOException ue) {
ue.printStackTrace();
}

finally
{

if (client != null && client.getManager() != null)
{
try {
client.getManager().stop();
client.getManager().dispose();
} catch (UMOException ex) {

}
}

}


}


/**
* @param args the command line arguments
*/
public static void main(String[] args) {
MuleMain mm = new MuleMain();
mm.doLaunch();
System.exit(0);
}

}

-----------------------------------------------------------
Supporting classes:

/*
* MultipleParams.java
*
* Created on September 5, 2007, 4:13 PM
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/

package foo.bar.mule;

import java.util.*;
import org.mule.umo.UMOEventContext;
import org.mule.umo.UMOMessage;
import org.mule.umo.lifecycle.Callable;

/**
*
* @author dyh
*/
public class MultipleParams implements Callable {

/** Creates a new instance of MultipleParams */
public MultipleParams() {
}

public Object onCall(UMOEventContext eventContext) throws Exception {
UMOMessage mm =eventContext.getMessage();
HashMap newMap = (HashMap) mm.getPayload();
return newMap;
}

}
-----------------------------------
/*
* GreetingService.java
*
* Created on September 5, 2007, 1:56 PM
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/

package foo.bar.mule;

/**
*
* @author dyh
*/
public interface GreetingService {
public String getGreetings(String info, int age);
}
/*
* SoapSample.java
*
* Created on September 5, 2007, 1:53 PM
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/

package foo.bar.mule;

/**
*
* @author dyh
*/
public class SoapSample implements GreetingService {

/** Creates a new instance of SoapSample */
public SoapSample() {
}

public String getGreetings(String info, int age)
{

return "Ho, ho "+info+" age "+age;

}

}
______________________________________________________________________

RESULTING ERROR:

ERROR 2007-09-05 16:32:40,494 [main]
org.mule.impl.DefaultComponentExceptionStrategy:
org.mule.impl.AbstractExceptionListener.logException(AbstractExceptionListener.java:306)
********************************************************************************
Message : Failed to route event via endpoint:
MuleEndpoint{connector=AxisConnector{this=2c1e6b, started=true,
initialised=true, name='axisConnector', disposed=false,
numberOfConcurrentTransactedReceivers=4,
createMultipleTransactedReceivers=true, connected=true,
supportedProtocols=[axis, axis:http, axis:https, axis:servlet, axis:vm,
axis:jms, axis:xmpp, axis:smtp, axis:smtps, axis:pop3, axis:pop3s,
axis:imap, axis:imaps, axis:ssl, axis:tcp, axis:http, axis:https,
axis:servlet, axis:vm, axis:jms, axis:xmpp, axis:smtp, axis:smtps,
axis:pop3, axis:pop3s, axis:imap, axis:imaps, axis:ssl, axis:tcp],
serviceOverrides=null},
endpointUri=http://localhost:2955/services/SoapTalkInterface?wsdl&method=getGreetings,
transformer=null,
name='endpoint.http.localhost.2955.services.SoapTalkInterface.wsdl.method.getGreetings',
type='senderAndReceiver', properties={method=getGreetings, wsdl=},
transactionConfig=Transaction{factory=null, action=NONE, timeout=30000},
filter=null, deleteUnacceptedMessages=false, initialised=true,
securityFilter=null, synchronous=true, initialState=started,
createConnector=0, remoteSync=null, remoteSyncTimeout=10000,
endpointEncoding=null}. Message payload is of type: HashMap
Type : org.mule.umo.provider.DispatchException
Code : MULE_ERROR-42999
Fault Code :
{http://schemas.xmlsoap.org/soap/envelope/}Server.userException
Fault Dump : AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: javax.xml.rpc.JAXRPCException: Number of parameters passed in
(1) doesn't match the number of IN/INOUT parameters (2) from the
addParameter() calls
faultActor:
faultNode:
faultDetail:

{http://xml.apache.org/axis/}stackTrace:javax.xml.rpc.JAXRPCException:
Number of parameters passed in (1) doesn't match the number of IN/INOUT
parameters (2) from the addParameter() calls
at org.apache.axis.client.Call.getParamList(Call.java:2059)
at org.apache.axis.client.Call.invoke(Call.java:2364)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at
org.mule.providers.soap.axis.AxisMessageDispatcher.doSend(AxisMessageDispatcher.java:145)
at
org.mule.providers.AbstractMessageDispatcher.send(AbstractMessageDispatcher.java:223)

et cetera


--
View this message in context: http://www.nabble.com/Testing-multiple-parameters-to-mule-axis-service-Mule-1.4.1-tf4388365.html#a12511748
Sent from the Mule - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

dhenton

unread,
Sep 5, 2007, 8:01:33 PM9/5/07
to us...@mule.codehaus.org

Upon further study of the list, it appears that I should wrap my parameters
as an Object array. Does this mean the unpacking of a map is out in 1.4.x?
--
View this message in context: http://www.nabble.com/Testing-multiple-parameters-to-mule-axis-service-Mule-1.4.1-tf4388365.html#a12513280
Reply all
Reply to author
Forward
0 new messages