how to call .net WebServices From Java Application

  1. Download to local the WDSL of your webservices
  2. 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
  3. Generate it whether through Soap Ui Plugin or Through Console of your Mapper Ex: wsimport -p mypackage -keep -d ToSOMEFolder C:\some.wsdl
  4. Add the Mypackage/whatever you named it To your java appliation src type Folder.
  5. 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

Share this post: | | | |
Published Monday, June 15, 2009 12:41 PM by cipto
Filed under:

Comments

# re: how to call .net WebServices From Java Application

Monday, June 15, 2009 3:16 PM by paulus

WSDL pak, bukan WDSL :D

# re: how to call .net WebServices From Java Application

Monday, June 15, 2009 3:31 PM by cipto

ok it's my typo. It's WSDL.

but i'm lazy to change it, leave it like that :P

# http://google.co.uk/search?hl=en&q=asp.net+jax-ws+web+service+undefined+simple+or+complex+type+'soapenc+array'+encoding&meta=

Thursday, August 06, 2009 7:33 PM by TrackBack