how to call .net WebServices From Java Application
- Download to local the WDSL of your webservices
- Add namespace to local WDSL, <s:import namespace="http:// ...
SchemaLocation> on Right before the soapenc:array and under schema Ex: <s:schema targetNamespace="somurl">
<s:import namespace="http://schemas.xmlsoap.org/soap/encoding/" schemaLocation="http://schemas.xmlsoap.org/soap/encoding/" />
<s:complexType name="StringArray">
<s:complexContent mixed="false">
<s:restriction base="soapenc:Array">, the reason for this is because soapenc array datatype is not supported there for has to have valid namespace , xml behaviour. else it throws error - Generate it whether through Soap Ui Plugin or Through Console of your Mapper Ex: wsimport -p mypackage -keep -d ToSOMEFolder C:\some.wsdl
- Add the Mypackage/whatever you named it To your java appliation src type Folder.
- Use it, Ex:
public static void main(String[] args) {
// TODO Auto-generated method stub
BACX0020WebX0020Service services=new BACX0020WebX0020Service();
BACX0020WebX0020ServiceSoap proxy=services.getBACX0020WebX0020ServiceSoap();
try {
SomeMethodResultResult result=proxy.somemethod(test1234", "test", utility.getBytesFromFile(new File("c:\\intro.wmv")));
System.out.println(result.getContent());
System.out.println("Finished");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
There are numerous of Mapper as seen on SoapUIplugin
JBossWS wstools
Axis 1.x
Axis 2
Jax-RPC Wscopmile
Jax-WS WSImport
CXF 2.x
XFire 1.x
XmlBeans 2.X
JAXB xjc
Apache TcpMon
Oracle Was.jar
WADL2Java
I'm using the JAX-WS 2.1.7