This is the code that I had to create to get Axis to call a .NET webservice
which returns a "binary file". Sounds like your situation is exactly the
oppisite, but this code should help.
Note the setting of the parameters (as if you could miss it) exp the BASE64
one.
Also very important is the SOAP action .NET "loves" the SOAP Action, but
would not read it from it's Axis client unless I explictly set it.
public byte[] aMethodToGet (String aString, String anotherString, String
moreString,String evenMoreString,String lastOfTheString) {
try {
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(this.endPoint);
call.addParameter("aString", XMLType.XSD_STRING,
String.class,ParameterMode.IN);
call.addParameter("anotherString", XMLType.XSD_STRING,
String.class,ParameterMode.IN);
call.addParameter("moreString", XMLType.XSD_STRING,
String.class,ParameterMode.IN);
call.addParameter("evenMoreString", XMLType.XSD_STRING,
String.class,ParameterMode.IN);
call.addParameter("lastOfTheString", XMLType.XSD_STRING,
String.class,ParameterMode.IN);
call.setReturnType(XMLType.XSD_BASE64);
QName operationQN = new QName(ACTIONBASE,"aMethodToGet");
call.setOperationName(operationQN);
String soapActionString = ACTIONBASE + "/aMethodToGet";
logger.debug("soapActionString = " + soapActionString);
call.setSOAPActionURI(soapActionString);
call.setUseSOAPAction(true);
call.setUsername(USERNAME);
call.setPassword(PASSWORD);
call.setOperationStyle("rpc");
byte[] pdf = (byte[]) call.invoke(new Object[]
{aString,anotherString,moreString,evenMoreString, lastOfTheString});
return pdf;
}
catch (ServiceException se) {
logger.debug("- - - - - - - - - - - - - - - -");
logger.error("Service Exception - aMethodToGet");
logger.error(se);
logger.debug("- - - - - - - - - - - - - - - -");
}
catch (IOException ioe) {
logger.debug("- - - - - - - - - - - - - - - -");
logger.error("IOException - aMethodToGet");
logger.error(ioe);
logger.debug("- - - - - - - - - - - - - - - -");
}
<[EMAIL PROTECTED]> on 07/02/2003 05:46:33 PM
Please respond to [EMAIL PROTECTED]
To: <[EMAIL PROTECTED]>
cc:
Subject: HELP-ME!!!
I�m tryng to do a Stateless Session Bean as webservice with attachament.
The SessionBean have a method:
public DataHandler getFile();
My deploy is:
<deployment xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<service name="ArquivoTeller" provider="java:EJB">
<parameter name="allowedMethods" value="*"/>
<parameter name="beanJndiName"
value="java:com/casaevideo/pi/server/informacao/arquivo/ArquivoTellerLocal
"/>
<parameter name="homeInterfaceName"
value
="com.casaevideo.pi.server.ejb.informacao.arquivo.ArquivoTellerLocalHome"/>
<parameter name="remoteInterfaceName"
value
="com.casaevideo.pi.server.ejb.informacao.arquivo.ArquivoTellerLocal"/>
</service>
</deployment>
All run fine... But i WSDL the type is
<wsdl:message name="getFileResponse">
<wsdl:part name="getFileReturn" type="apachesoap:DataHandler"/>
</wsdl:message>
Why? I want to user Attachaments. What I need to do. I tried to use as it,
but when I
try to import wsdl to C# this type is not imported.
All other method run fine... The webservice without it is ok.
Please! Help-me!