Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Javaµ÷ÓÃ.NETµÄWebService

1£®  »ù±¾¿â
cxf-2.2.4.jar
XmlSchema-1.4.5.jar
Wsdl4j-1.6.2.java
2£®  ÔÚ.NETÖбàд·þÎñ£¬Ä¬ÈϲÎÊý¼´¿É£¬È磺
namespace TestService2Java
{
    [WebService(Namespace = "http://temp2java.org/")]    //½ö´Ë´¦ÉÔ¼ÓÐ޸쬲»¸ÄÒ²¿É
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    public class Service1 : System.Web.Services.WebService
    {
        [WebMethod]
        public string HelloWorld()
        {
            return "Hello World";
        }
        [WebMethod]
        public int MathAdd(int a, int b)   //¶¨ÒåÒ»¸öз½·¨
        {
            return a + b;
        }
    }
}
3£®  Éú³ÉJavaÖÐʹÓõÄÀ࣬ʹÓÃwsdl2java£º
wsdl2java –p test.net.service –d d:\src http://localhost/svr2java/Service1.asmx?wsdl
½«Éú³ÉÎļþÖеÄService1Soap.javaµ¼ÈëjavaÏîÄ¿¡£
±¸×¢£º//@XmlSeeAlso({ObjectFactory.class})£¬·ñÔòµ÷Óûá³ö´í¡£
4£®  µ÷Ó÷þÎñ£º
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import java.net.URL;
public class CallDotNetService {
    public final static QName SERVICE = new QName("http://temp2java.org/", "Service1");
    public final static QName Service1Soap = new QName("http://temp2java.org/", "Service1Soap");
private CallDotNetService() {   }
public static void main(String args[]) throws Exception {
     URL wsdlURL = new URL("http://localhost/svr2java/Service1.asmx?wsdl");
 


Ïà¹ØÎĵµ£º

dz̸Java·ºÐͱà³Ì

 
dz̸Java·ºÐͱà³Ì
1 ÒýÑÔÔÚJDK 1.5ÖУ¬¼¸¸öеÄÌØÕ÷±»ÒýÈëJavaÓïÑÔ¡£ÆäÖÐÖ®Ò»¾ÍÊÇ·ºÐÍ£¨generics£©¡£·ºÐÍ£¨generics£¬genericity£©ÓÖ³ÆÎª“²ÎÊýÀàÐÍ»¯£¨parameterized type£©”»ò“Ä£°å£¨templates£©”£¬ÊǺͼ̳У¨inheritance£©²»Í¬¶ø»¥²¹µÄÒ»ÖÖ×é¼þ¸´ÓûúÖÆ¡£¼Ì³ÐºÍ·ºÐ͵IJ»Í¬Ö®´¦ÔÚÓÚ&mda ......

JAVA¶ÁÈ¡Îļþ£¬±ÜÃâÖÐÎÄÂÒÂë¡£

 1¡¢JAVA¶ÁÈ¡Îļþ£¬±ÜÃâÖÐÎÄÂÒÂë¡£
/**
* ¶ÁÈ¡ÎļþÄÚÈÝ
*
* @param filePathAndName
*            String Èç c:\\1.txt ¾ø¶Ô·¾¶
* @return boolean
*/
public static String readFile(String filePathAndName) {
   String fileContent ......

JavaÏòÉÏתÐÍ

ͨË×Àí½âÏòÉÏתÐÍ£º
¾ÍÊÇ×ÓÀàתÐͳɸ¸Àà¡£
class A{}
class B extends A { }
A b = new B();
Õâ¸ö¾ÍÊÇÏòÉÏתÐÍ¡£
ÏòÉÏתÐÍ¿ÉÒÔÏñÏÂÃæÕâÌõÓï¾äÕâô¼òµ¥:
      Shape s =new Circle();
      ÕâÀ´´½¨Ò»¸öCircle¶ÔÏ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ