During the project today, some problems encountered when the java server uses cxf to dynamically call the. net Service are as follows.
1. CXF is the OpenSource ESB Celtix of IONA and apache Incubate project merged with the so-called fastest Soap protocol stack XFire.
CXF is an implementation of a JAX-WS API.
CXF supports multiple types of binding and transport.
CXF supports service models other than JAX-WS, such as JBI, CORBA, and SCA.
2, online information: http://www.cnblogs.com/yg_zhang/archive/2010/11/15/1877658.html
3. Generate the. net web service proxy class on myeclipse, that is, web Service Client. Right-click the project and choose create> Other> MyEclipse> Web Service Client.
4, C # Call Java service reference: http://blog.csdn.net/cheng110110/article/details/6440002
5. Java and. NET call each other through wenservice: http://www.ibeifeng.com/tech.php? Id = 6105
6,
- View Code
- /**
- * PubService returns the Stirng type and the Stirng type of the parameter.
- */
- @ Override
- Public String PubService (String data)
- {
- String str = Usual. mEmpty;
- String mReturn = "0001 ";
- String [] mStr = data. split (",");
- If (mStr [0]. equals ("inlogin") & mStr [1]. equals ("inlogin "))
- {
- MReturn = "000 ";
- }
- String serviceURL = "http: // 192.168.0.35/com.net/InService.asmx ";
- Try
- {
- JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean ();
- // You can use myeclipse to create a Web Service Client and reference the. class Object.
- Factory. setServiceClass (InServiceSoap. class );
- // Specify the URL path here. If InServiceSoap is not an interface class,
- // The following code will report an error indicating that it is not an Interface
- // You must use an interface when using java cxf.
- Factory. setAddress (serviceURL + "? Wsdl ");
- // Two parameters of the QName function. The first parameter is the namespace, and the second parameter is the service name of the webservice.
- // The first parameter can be found when the. net service is released, that is, targetnamespace,
- // The second parameter can be found in the java interface implementation class, that is, serviceName.
- Factory. setServiceName (new QName ("http://con.java.service/", "wss "));
- // InServiceSoap is an interface generated by the. net web Service Client.
- InServiceSoap client = (InServiceSoap) factory. create ();
- // PublishInformation
- Str = client. publishInformation (mStr [0], mReturn, "20000", "dfadasd ");
- System. out. println ("str: Call. net interface:" + str );
- Client = null;
- Factory = null;
- }
- Catch (Exception e)
- {
- // TODO: handle exception
- E. printStackTrace ();
- }
- Finally
- {
- }
- Return mReturn;
- }