<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    博學(xué)而篤志,好問而近思

    【原創(chuàng)】關(guān)于Web Services以及Axis2技術(shù)(客戶端和服務(wù)器端實(shí)現(xiàn))

                          Web Services以及Axis2技術(shù)之二

        本篇是繼關(guān)于Axis2發(fā)布Web Service之后的又一隨筆,此篇的主要任務(wù)是講述使用Axis2開發(fā)客戶端和服務(wù)器端的具體實(shí)現(xiàn)。相信大家在看本篇的時(shí)候已經(jīng)具備了一定的Web Service開發(fā)基礎(chǔ),因此我主要是以例子的方式來說明,文字會相對較少。同時(shí),我會在最后提供幾個(gè)優(yōu)秀的網(wǎng)址給大家。

        例一(簡單的字符串傳送服務(wù)實(shí)現(xiàn))

    客戶端
    com.udm.iudmservice.IUDMServiceStub stub = new com.udm.iudmservice.IUDMServiceStub(); 
    com.udm.iudmservice.types.GetUserAllRegServices param234 =  (com.udm.iudmservice.types.GetUserAllRegServices) getTestObject (com.udm.iudmservice.types.GetUserAllRegServices.class);
    GetUserAllRegServicesResponse resp = stub.getUserAllRegServices(param234);
    OMElement ret = resp.get_return()[0];
    System.out.println(ret.getText());                               //此為測試語句
    服務(wù)器端:

    GetUserAllRegServicesResponse res = new GetUserAllRegServicesResponse();
    OMElement resp = fac.createOMElement("Return", omNs);
    resp.setText("返回的結(jié)果!");
    System.out.println("返回結(jié)果為:" + resp.getText());  //此為測試語句
    res.set_return(new OMElement[] { resp });

        例二(文件傳送的具體實(shí)現(xiàn))

    客戶端:
    import org.apache.axiom.om.OMAbstractFactory;
    import org.apache.axiom.om.OMElement;
    import org.apache.axiom.om.OMFactory;
    import org.apache.axiom.om.OMNamespace;
    import org.apache.axiom.om.OMText;
    import org.apache.axiom.soap.SOAP11Constants;
    import org.apache.axiom.soap.SOAP12Constants;
    import org.apache.axis2.Constants;
    import org.apache.axis2.addressing.EndpointReference;
    import org.apache.axis2.client.Options;
    import org.apache.axis2.client.ServiceClient;
     
    import javax.activation.DataHandler;
    import javax.activation.FileDataSource;
    import javax.xml.namespace.QName;
    import java.io.File;
    import java.io.InputStream;
     
    public class FileTransferClient {
       private static EndpointReference targetEPR = new EndpointReference("http://127.0.0.1:8080/axis2/services/interop");
      
       public static boolean upload(String mailboxnum, short greetingType, File file, String fileType) {
         try {
          OMElement data = buildUploadEnvelope(mailboxnum, greetingType, file, fileType);
          Options options = buildOptions();
          ServiceClient sender = new ServiceClient();
          sender.setOptions(options);
          System.out.println(data);
          OMElement ome = sender.sendReceive(data);
          System.out.println(ome);
          String b = ome.getText();
          return Boolean.parseBoolean(b);
         }
         catch(Exception e) {
          
         }
         return false;
       }
       public static InputStream download(String mailboxnum, short greetingType, String FileType) {
         try {
           OMElement data = buildDownloadEnvelope(mailboxnum, greetingType, FileType);
           Options options = buildOptions();
           ServiceClient sender = new ServiceClient();
           sender.setOptions(options);
           System.out.println(data);
           OMElement ome = sender.sendReceive(data);
           System.out.println(ome);
           OMText binaryNode = (OMText) ome.getFirstOMChild();
           DataHandler actualDH = (DataHandler) binaryNode.getDataHandler();
           return actualDH.getInputStream();
          }
          catch(Exception e) {
          }
         return null;
       }
      
       private static OMElement buildUploadEnvelope(String mailboxnum, short greetingType, File file, String FileType) {
         DataHandler expectedDH;
         OMFactory fac = OMAbstractFactory.getOMFactory();
         OMNamespace omNs = fac.createOMNamespace("http://example.org/mtom/data", "x");
         OMElement data = fac.createOMElement("upload", omNs);
         OMElement fileContent = fac.createOMElement("fileContent", omNs);
         FileDataSource dataSource = new FileDataSource(file);
         expectedDH = new DataHandler(dataSource);
         OMText textData = fac.createOMText(expectedDH, true);
         fileContent.addChild(textData);
         OMElement mboxnum = fac.createOMElement("mailboxnum", omNs);
         mboxnum.setText(mailboxnum);
         OMElement gtType = fac.createOMElement("greetingType", omNs);
         gtType.setText(greetingType+"");
         OMElement fileType=fac.createOMElement("fileType", omNs);
         fileType.setText(FileType);
      
         data.addChild(mboxnum);
         data.addChild(gtType);
         data.addChild(fileType);
         data.addChild(fileContent);
         return data;
       }
       private static OMElement buildDownloadEnvelope(String mailboxnum, short greetingType, String FileType) {
         OMFactory fac = OMAbstractFactory.getOMFactory();
         OMNamespace omNs = fac.createOMNamespace("http://example.org/mtom/data", "x");
         OMElement data = fac.createOMElement("download", omNs);
         OMElement mboxnum = fac.createOMElement("mailboxnum", omNs);
         mboxnum.setText(mailboxnum);
         OMElement gtType = fac.createOMElement("greetingType", omNs);
         gtType.setText(greetingType+"");
         OMElement fileType=fac.createOMElement("fileType", omNs);
         fileType.setText(FileType);
         data.addChild(mboxnum);
         data.addChild(gtType);
         data.addChild(fileType);
         return data;
       }
       private static Options buildOptions() {
         Options options = new Options();
         options.setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
         options.setTo(targetEPR);
         // enabling MTOM in the client side
         options.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
         options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
         return options;
       }
       public static void main(String agrs[]) {    //此為測試主函數(shù)
         String file = "C:/deploy.wsdd";
         short gt = 1;
         String mn = "20060405";
         String ft="wsdd";
         boolean rtv = upload(mn,gt,new File(file),ft);
         System.out.println(rtv);
         InputStream is = download(mn,gt,ft);
       }
    }
    服務(wù)器端

    import org.apache.axiom.attachments.utils.IOUtils;
    import org.apache.axiom.om.OMAbstractFactory;
    import org.apache.axiom.om.OMElement;
    import org.apache.axiom.om.OMFactory;
    import org.apache.axiom.om.OMNamespace;
    import org.apache.axiom.om.OMText;
    import org.apache.axis2.AxisFault;
    import java.io.FileOutputStream;
    import java.io.*;
    import java.util.Iterator;
     
    import javax.activation.DataHandler;
    import javax.activation.FileDataSource;
     
    public class interopService {
     public static final String TMP_PATH = "c:/tmp";
     public OMElement upload(OMElement element) throws Exception {
        OMElement _fileContent = null;
        OMElement _mailboxnum = null;
        OMElement _greetingType = null;
        OMElement _fileType = null;
        System.out.println(element);
        for (Iterator _iterator = element.getChildElements(); _iterator.hasNext();) {
          OMElement _ele = (OMElement) _iterator.next();
          if (_ele.getLocalName().equalsIgnoreCase("fileContent")) {
            _fileContent = _ele;
          }
          if (_ele.getLocalName().equalsIgnoreCase("mailboxnum")) {
            _mailboxnum = _ele;
          }
          if (_ele.getLocalName().equalsIgnoreCase("greetingType")) {
            _greetingType = _ele;
          }
          if (_ele.getLocalName().equalsIgnoreCase("fileType")) {
            _fileType = _ele;
          }
        }
     
        if (_fileContent == null || _mailboxnum == null || _greetingType== null || _fileType==null) {
          throw new AxisFault("Either Image or FileName is null");
        }
     
        OMText binaryNode = (OMText) _fileContent.getFirstOMChild();
     
        String mboxNum = _mailboxnum.getText();
        String greetingType = _greetingType.getText();
        String fileType = _fileType.getText();
     
        String greetingstoreDir = TMP_PATH+"/"+mboxNum;
        File dir = new File(greetingstoreDir);
        if(!dir.exists()) {
          dir.mkdir();
        }
        String filePath = greetingstoreDir+"/"+greetingType+"."+fileType;
        File greetingFile = new File(filePath);
        if(greetingFile.exists()) {
          greetingFile.delete();
          greetingFile = new File(filePath);
        }
       
        // Extracting the data and saving
        DataHandler actualDH;
        actualDH = (DataHandler) binaryNode.getDataHandler();
        
        FileOutputStream imageOutStream = new FileOutputStream(greetingFile);
        InputStream is = actualDH.getInputStream();
        imageOutStream.write(IOUtils.getStreamAsByteArray(is));
        // setting response
        OMFactory fac = OMAbstractFactory.getOMFactory();
        OMNamespace ns = fac.createOMNamespace("http://example.org/mtom/data", "x");
        OMElement ele = fac.createOMElement("response", ns);
        ele.setText("true");
       
        return ele;
     }
     public OMElement download(OMElement element) throws Exception {
        System.out.println(element);
        OMElement _mailboxnum = null;
        OMElement _greetingType = null;
        OMElement _fileType = null;
        for (Iterator _iterator = element.getChildElements(); _iterator.hasNext();) {
          OMElement _ele = (OMElement) _iterator.next();
          if (_ele.getLocalName().equalsIgnoreCase("mailboxnum")) {
            _mailboxnum = _ele;
          }
          if (_ele.getLocalName().equalsIgnoreCase("greetingType")) {
            _greetingType = _ele;
          }
          if (_ele.getLocalName().equalsIgnoreCase("fileType")) {
            _fileType = _ele;
          }
        }
        String mboxNum = _mailboxnum.getText();
        String greetingType = _greetingType.getText();
        String fileType = _fileType.getText();
        String filePath = TMP_PATH+"/"+mboxNum+"/"+greetingType+"."+fileType;
        FileDataSource dataSource = new FileDataSource(filePath);
        DataHandler expectedDH = new DataHandler(dataSource);
       
        OMFactory fac = OMAbstractFactory.getOMFactory();
       
        OMNamespace ns = fac.createOMNamespace("http://example.org/mtom/data", "x");
        OMText textData = fac.createOMText(expectedDH, true);
        OMElement ele = fac.createOMElement("response", ns);
        ele.addChild(textData);
        return ele;
     }
    }
    Services.xml配置文件:
    <servicename="MTOMService">
        <description>
            This is a sample Web Service with two operations,echo and ping.
        </description>
        <parametername="ServiceClass"locked="false">sample.mtom.interop.service.interopService</parameter>
        <operationname="upload">
            <actionMapping>urn:upload</actionMapping>
            <messageReceiverclass="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
        </operation>
          <operationname="download">
            <actionMapping>urn:download</actionMapping>
            <messageReceiverclass="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
        </operation>
    </service>

    兩個(gè)學(xué)習(xí)網(wǎng)址http://www-128.ibm.com/developerworks/cn/(IBM的開發(fā)網(wǎng)中國站)
                                    http://www.apache.org/ (Apache組織的官方網(wǎng)站)

        最后:祝福大家在程序的天空里越飛越高!!!


                                                                                                                             ------ 冰川
                                                                                                                                  2006-9-1


    posted on 2006-09-01 10:17 冰川 閱讀(20125) 評論(48)  編輯  收藏

    評論

    # re: 【原創(chuàng)】關(guān)于Web Serviece以及Axis2技術(shù)(客戶端和服務(wù)器端實(shí)現(xiàn)) 2006-09-14 21:09 shaofan

    axis2有什么不同?新舊版本好像是并行開發(fā)的  回復(fù)  更多評論   

    # re: 【原創(chuàng)】關(guān)于Web Serviece以及Axis2技術(shù)(客戶端和服務(wù)器端實(shí)現(xiàn)) 2006-09-15 14:29 冰川

    @shaofan:
    不是并行發(fā)行的,Axis2.0 的1.0版本是最新的版本2006-5-4號發(fā)布的。
    只所以有個(gè)Axis(1.x)是為了提供對Axis以前版本用戶的支持。
    因?yàn)椴⒉皇敲總€(gè)項(xiàng)目都會升級到最新版本,有的用戶習(xí)慣了用老版本的。  回復(fù)  更多評論   

    # re: 【原創(chuàng)】關(guān)于Web Serviece以及Axis2技術(shù)(客戶端和服務(wù)器端實(shí)現(xiàn)) 2006-11-10 11:07 shrimplucky

    你好,現(xiàn)在剛?cè)胧謅xis2 ,想利用里面的例子試驗(yàn)從WSDL文件生成skeleton,依據(jù)userguide,可是編譯時(shí)竟找不到xsd中的類,可明明對應(yīng)的class 文件生成了。
      回復(fù)  更多評論   

    # re: 【原創(chuàng)】關(guān)于Web Serviece以及Axis2技術(shù)(客戶端和服務(wù)器端實(shí)現(xiàn)) 2006-11-10 14:17 冰川

    找不到xsd中的類?不知道你具體想要做什么事。  回復(fù)  更多評論   

    # re: 【原創(chuàng)】關(guān)于Web Serviece以及Axis2技術(shù)(客戶端和服務(wù)器端實(shí)現(xiàn)) 2006-11-12 15:59 shrimplucky

    @冰川

    用它的build.xml直接處理了,呵呵

    問個(gè)問題,Axis2是否支持Spring AOP,我想使用攔截功能,考慮到使用 Handler 攔截是在 message going out時(shí)攔截,如果一個(gè)操作不返回值時(shí)handler是否也能在操作完成之后進(jìn)行攔截呢?

    XFire用過嗎?它的Axis2有什么差別?謝謝

      回復(fù)  更多評論   

    # re: 【原創(chuàng)】關(guān)于Web Serviece以及Axis2技術(shù)(客戶端和服務(wù)器端實(shí)現(xiàn)) 2006-11-12 16:15 冰川

    @shrimplucky:
    1.很抱歉,這個(gè)問題我沒接觸過
    2.XFire聽說也是個(gè)很不錯的東東,但我沒有用過

      回復(fù)  更多評論   

    # re: 【原創(chuàng)】關(guān)于Web Serviece以及Axis2技術(shù)(客戶端和服務(wù)器端實(shí)現(xiàn)) 2006-11-18 16:13 neusoft

    "org.apache.axis2.AxisFault: Module not found"

    classpath設(shè)了addressing-1.0.mar了,還是不好用。  回復(fù)  更多評論   

    # re: 【原創(chuàng)】關(guān)于Web Serviece以及Axis2技術(shù)(客戶端和服務(wù)器端實(shí)現(xiàn)) 2006-12-01 18:12 霄羽

    大文件上傳設(shè)置了文件緩存如下:
    <parameter name="cacheAttachments" locked="false">true</parameter>
    <parameter name="attachmentDIR" locked="false">C:/upload/tep/</parameter>
    <parameter name="sizeThreshold" locked="false">4000</parameter>

    不知道怎么回事,上傳文件少4個(gè)字節(jié),痛苦啊  回復(fù)  更多評論   

    # re: 【原創(chuàng)】關(guān)于Web Serviece以及Axis2技術(shù)(客戶端和服務(wù)器端實(shí)現(xiàn)) 2006-12-19 18:28 曉剛

    問一個(gè)很弱的問題,客戶端生成器生成的java代碼,怎么調(diào)用啊?基于Axis2開發(fā)  回復(fù)  更多評論   

    # re: 【原創(chuàng)】關(guān)于Web Serviece以及Axis2技術(shù)(客戶端和服務(wù)器端實(shí)現(xiàn)) 2006-12-19 21:03 嘎崩豆

    為什么會出現(xiàn) services.xml not found for service ,說是找不到對應(yīng)的aar文件,可是明明是對照著寫的啊  回復(fù)  更多評論   

    # re: 【原創(chuàng)】關(guān)于Web Serviece以及Axis2技術(shù)(客戶端和服務(wù)器端實(shí)現(xiàn)) 2006-12-19 21:04 嘎崩豆

    我的問題是在部署一個(gè)自己的AddService時(shí)出現(xiàn)的,想利用反回兩個(gè)數(shù)的和來進(jìn)行驗(yàn)證  回復(fù)  更多評論   

    # re: 【原創(chuàng)】關(guān)于Web Serviece以及Axis2技術(shù)(客戶端和服務(wù)器端實(shí)現(xiàn)) 2006-12-20 14:55 冰川

    @曉剛:
    俺沒有使用過客戶端生成器。。。
    @嘎崩豆:
    你是對照哪里的寫的啊?檢查一下你Web Services的配置,看看路徑是不是對的?

      回復(fù)  更多評論   

    # re: 【原創(chuàng)】關(guān)于Web Services以及Axis2技術(shù)(客戶端和服務(wù)器端實(shí)現(xiàn)) 2007-03-14 17:09 啊啊

    可以用eclipse的axis2-java2wsdl-maven-plugin-1.1.1和axis2-wsdl2code-maven-plugin-1.1.1插件生成client端的stub和server端的skeletone.非常簡單axis2的官方網(wǎng)站上有下載.  回復(fù)  更多評論   

    # re: 【原創(chuàng)】關(guān)于Web Services以及Axis2技術(shù)(客戶端和服務(wù)器端實(shí)現(xiàn)) 2007-03-14 17:16 冰川

    謝謝支持。。  回復(fù)  更多評論   

    # re: 【原創(chuàng)】關(guān)于Web Services以及Axis2技術(shù)(客戶端和服務(wù)器端實(shí)現(xiàn))[未登錄] 2007-04-17 09:52 soa

    想問樓主一個(gè)問題,通過axis2客戶端調(diào)用ws,返回的結(jié)果中,含有中文,如果結(jié)果只有一條,我還好處理,直接用e.gettext(),就得到我想要的,但是如果有多條結(jié)果的話,如果我用e.getText(),那么結(jié)果就亂了,不能一一對應(yīng)起來,然后我想用dom4j解析,但是解析出來之后,中文都是亂碼,怎么設(shè)置編碼都不對,請問有什么好的解決辦法嗎?  回復(fù)  更多評論   

    # re: 【原創(chuàng)】關(guān)于Web Services以及Axis2技術(shù)(客戶端和服務(wù)器端實(shí)現(xiàn))[未登錄] 2007-04-17 09:59 soa

    <ns1:GoodsCheckResponse xmlns:ns1="http://www.example.org/goodsflow/">
    <id>3</id>
    <id>4</id>
    <hwmc>abab</hwmc>
    <hwmc>鍙扮伅</hwmc>
    <dw>涓?</dw>
    <dw>涓?</dw>
    </ns1:GoodsCheckResponse>
    返回結(jié)果,結(jié)構(gòu)如下,然后我想用先講上面的結(jié)果轉(zhuǎn)換成字符串,然后用dom4j的documentHelper換成document,再用dom4j解析,取出來的就是亂碼。
    我覺得問題可能是在轉(zhuǎn)換的時(shí)候產(chǎn)生的,但是不轉(zhuǎn)換,又不懂怎么解析,請問有什么好方法嗎  回復(fù)  更多評論   

    # re: 【原創(chuàng)】關(guān)于Web Services以及Axis2技術(shù)(客戶端和服務(wù)器端實(shí)現(xiàn)) 2007-05-18 14:07 cmzhao

    請問這個(gè)是什么問題???
    org.apache.axis2.AxisFault: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog at [row,col {unknown-source}]: [1,0]
    at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:434)
    at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:373)
    at org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:294)
    at sample.addressbook.service.MsgServiceMsgServiceSOAP11Port_httpStub.getMsg(MsgServiceMsgServiceSOAP11Port_httpStub.java:205)
    at sample.addressbook.adbclient.AddressBookADBClient.main(AddressBookADBClient.java:45)
      回復(fù)  更多評論   

    # re: 【原創(chuàng)】關(guān)于Web Services以及Axis2技術(shù)(客戶端和服務(wù)器端實(shí)現(xiàn)) 2007-05-19 14:26 冰川

    @cmzhao:
    WstxEOFException是在解析XML文件時(shí)遇到錯誤,導(dǎo)致這個(gè)錯誤原因Exception thrown during parsing, if an unexpected EOF is encountered. Location usually signals starting position of current Node。
    prolog at [row,col {unknown-source}]: [1,0]是在解析XML文件時(shí)未知來源,可能是你的WSDL命名空間錯誤,去檢查一下。

    @soa:
    你的XML文件如果是encoding=“UTF-8”,把它改成encoding=“GBK”。
    另外,看看你的數(shù)據(jù)庫的字符編碼設(shè)置,如果不是“GBK”的則要需要轉(zhuǎn)化,還有你全局配置文件里的設(shè)置,如Web.xml里的字符編碼,總之影響你的顯示的中文內(nèi)容的相關(guān)字符編碼配置最好一致。  回復(fù)  更多評論   

    # re: 【原創(chuàng)】關(guān)于Web Services以及Axis2技術(shù)(客戶端和服務(wù)器端實(shí)現(xiàn))[未登錄] 2007-07-27 11:37 mask

    public class Axis2Client {
    private static EndpointReference targetEPR =
    new EndpointReference("http://202.*.*.*:8080/axis2/services/Version");
    //這一行如果改為localhost:8080則正常調(diào)用
    public static void main(String[] args) {
    try {
    RPCServiceClient serviceClient = new RPCServiceClient();
    Options options = serviceClient.getOptions();
    options.setTo(targetEPR);
    // 待調(diào)用服務(wù)的名稱
    QName opGetVersion = new QName("http://axisversion.sample/xsd", "getVersion");
    // 服務(wù)參數(shù)
    String str = "hello";
    Object[] opGetVersionArgs = new Object[] { str };
    // 返回類型
    Class[] returnTypes = new Class[] { String.class };
    // 阻塞調(diào)用,得到返回值
    Object[] response = serviceClient.invokeBlocking(opRedToGreen,
    opRedToGreenArgs, returnTypes);
    System.out.println(response[0]);
    } catch (Exception e) {
    e.printStackTrace();
    }
    }
    }

    上面的示例代碼是訪問axis2 1.1的version服務(wù)的,當(dāng)EPR為IP地址時(shí),會出現(xiàn)以下錯誤:
    org.apache.axis2.AxisFault: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog
    at [row,col {unknown-source}]: [1,0]
    at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:271)
    at org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:202)
    at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:579)
    at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:508)
    at org.apache.axis2.rpc.client.RPCServiceClient.invokeBlocking(RPCServiceClient.java:95)
    at Axis2Client.main(Axis2Client.java:36)
    但是將ERP中的IP地址改為localhost時(shí),則正常返回。
    請問這是什么問題,謝謝了!  回復(fù)  更多評論   

    # re: 【原創(chuàng)】關(guān)于Web Services以及Axis2技術(shù)(客戶端和服務(wù)器端實(shí)現(xiàn)) 2007-08-06 09:20 xl

    我也遇到同樣問題,service的入口地址只能用localhost或127.0.0.1,不能使用實(shí)際的IP地址。否則會報(bào)錯:org.apache.axis2.AxisFault: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog
    at [row,col {unknown-source}]: [1,0]。

    Axis1.1,1.2,1.3RC都試過了。
    環(huán)境:
    XP Home SP2
    Tomcat 5.0.28
    java 1.4.2_11  回復(fù)  更多評論   

    # re: 【原創(chuàng)】關(guān)于Web Services以及Axis2技術(shù)(客戶端和服務(wù)器端實(shí)現(xiàn)) 2007-08-06 11:15 冰川

    @mask and @xl
    很抱歉,最近很忙,所以有一陣子沒上來了
    是同樣的問題,我就一起回了啊,調(diào)試本機(jī)的Web Service服務(wù)程序要用localhost或127.0.0.1,原因是當(dāng)你設(shè)置的是實(shí)際IP地址,你的客戶端程序?qū)ㄟ^DNS服務(wù)器來找這個(gè)Web Service服務(wù)程序所在服務(wù)器的IP地址,如果你的計(jì)算機(jī)或服務(wù)器是獨(dú)立的IP地址則不會出現(xiàn)錯誤。如果你的電腦是通過的代理上網(wǎng)是動態(tài)分配的IP,或是一個(gè)域下面的局域網(wǎng)IP則不行。總而言之,你的Web Service服務(wù)程序要發(fā)布在擁有獨(dú)立IP的服務(wù)端,客戶端才能夠通過向這個(gè)IP發(fā)送請求來獲得服務(wù)。


      回復(fù)  更多評論   

    # re: 【原創(chuàng)】關(guān)于Web Services以及Axis2技術(shù)(客戶端和服務(wù)器端實(shí)現(xiàn)) 2007-08-06 11:40 xl(wxxl22@163.com)

    to 冰川
    我影射一個(gè)本地域名也不可以,比如(www.xl.com->10.xx.xx.xx),ping一下www.xl.com可以ping通10.xx.xx.xx。
    然后我把EndpointReference targetEPR = new EndpointReference(
    "http://localhost:8080/axis2/services/Version");
    中的localhost換成www.xl.com還是同樣的錯誤。
    我覺得不是IP地址的問題,照這樣說WebService豈不是不能發(fā)布在局域網(wǎng)中了。  回復(fù)  更多評論   

    # re: 【原創(chuàng)】關(guān)于Web Services以及Axis2技術(shù)(客戶端和服務(wù)器端實(shí)現(xiàn)) 2007-08-07 09:18 xl(wxxl22@163.com)

    我還發(fā)現(xiàn)入口地址改成IP地址后,INOnly操作能夠正確調(diào)用,比如StockQuoteService的update操作,但是INOut操作調(diào)用失敗,比如StockQuoteService的getPrice操作,這說明不是尋址問題.  回復(fù)  更多評論   

    # re: 【原創(chuàng)】關(guān)于Web Services以及Axis2技術(shù)(客戶端和服務(wù)器端實(shí)現(xiàn)) 2007-08-15 13:56 lizhaning

    暈到,有那么復(fù)雜么,IP不用改變,把你們的防火墻關(guān)掉,一試就OK.  回復(fù)  更多評論   

    # re: 【原創(chuàng)】關(guān)于Web Services以及Axis2技術(shù)(客戶端和服務(wù)器端實(shí)現(xiàn)) 2007-08-20 10:39 xl(wxxl22@163.com)

    不是防火墻的問題,我試過了,沒用。
    如果是防火墻阻擋,不可能INOnly操作能夠正確調(diào)用,INOut操作調(diào)用失敗,應(yīng)該都失敗的。  回復(fù)  更多評論   

    # re: 【原創(chuàng)】關(guān)于Web Services以及Axis2技術(shù)(客戶端和服務(wù)器端實(shí)現(xiàn)) 2007-08-22 09:41 xl(wxxl22@163.com)

    上面說錯了,今天用SOAPMonitor看了一下,改為IP地址后服務(wù)端確實(shí)沒有接收到請求信息,因此所有操作都失敗。但是確實(shí)關(guān)閉防火墻也不行,再查原因中…………  回復(fù)  更多評論   

    # re: 【原創(chuàng)】關(guān)于Web Services以及Axis2技術(shù)(客戶端和服務(wù)器端實(shí)現(xiàn)) 2007-08-22 13:57 lizhaning

    把殺毒軟件都停掉試下!:)我的就不會出現(xiàn)錯誤了,
    為什么會這樣,原因我也在查...  回復(fù)  更多評論   

    # re: 【原創(chuàng)】關(guān)于Web Services以及Axis2技術(shù)(客戶端和服務(wù)器端實(shí)現(xiàn)) 2007-08-22 14:02 lizhaning

    關(guān)鍵我想請教下如何傳遞容器對象,比如List,如何在客戶端得到一個(gè)List對象?
    誰能幫解答下,謝謝.  回復(fù)  更多評論   

    # re: 【原創(chuàng)】關(guān)于Web Services以及Axis2技術(shù)(客戶端和服務(wù)器端實(shí)現(xiàn)) 2007-08-28 16:55 wu

    我想問一個(gè)可能比較簡單的問題, 怎么定位aar包里的文件?我把一個(gè)文件放在aar包里的根目錄下,調(diào)用的時(shí)候不給出路徑,就會出錯,說找不到這個(gè)文件。可我試了很多路徑都不行。誰知道的話,可否給個(gè)答案,謝謝.  回復(fù)  更多評論   

    # re: 【原創(chuàng)】關(guān)于Web Services以及Axis2技術(shù)(客戶端和服務(wù)器端實(shí)現(xiàn)) 2007-08-29 13:28 xl(wxxl22@163.com)

    試了一下,確實(shí)是殺毒軟件的原因,我裝的是KB,關(guān)閉“WEB反病毒保護(hù)”和"反間諜保護(hù)"后可正常訪問WebServices。

    to:izhaning
    據(jù)我了解不能傳遞容器對象的,我倒是試過可以傳遞Pojo數(shù)組。  回復(fù)  更多評論   

    # re: 【原創(chuàng)】關(guān)于Web Services以及Axis2技術(shù)(客戶端和服務(wù)器端實(shí)現(xiàn)) 2007-08-29 13:45 xl(wxxl22@163.com)

    to: wu
    我是用MyClass.class.getResource("/").toString();方法取得$tomcat$\webapps\axis2\WEB-INF\classes路徑,我把自己的一些配置文件放在了該路徑下。這只是個(gè)變通的方法,不知道對你有沒有用。
    另外,你找到正確的方法后告訴我一聲。  回復(fù)  更多評論   

    # re: 【原創(chuàng)】關(guān)于Web Services以及Axis2技術(shù)(客戶端和服務(wù)器端實(shí)現(xiàn)) 2007-08-29 17:37 wu

    多謝你的答復(fù)。我希望是能把這些文件打包在aar文件里面,而不是放在axis2的classes下面,這樣發(fā)布更方便一些。不過我在apache axis2的網(wǎng)站下找到答案了: http://ws.apache.org/axis2/faq.html#b1
    用getClass().getClassLoader().getResourceAsStream("myResource");
    可以搞定了。之前還找了半天,原來這里的問題解答里面就有,真是郁悶。  回復(fù)  更多評論   

    # re: 【原創(chuàng)】關(guān)于Web Services以及Axis2技術(shù)(客戶端和服務(wù)器端實(shí)現(xiàn)) 2007-09-29 17:34 wowoer

    你們好,我也剛開始弄axis2,也報(bào)那個(gè)錯誤,但是,我的是localhost啊,不知道怎么回事,還有說命名空間有問題,這個(gè)命名空間應(yīng)該怎么定義呢??謝謝大家。  回復(fù)  更多評論   

    # re: 【原創(chuàng)】關(guān)于Web Services以及Axis2技術(shù)(客戶端和服務(wù)器端實(shí)現(xiàn)) 2007-09-29 17:37 wowoer

    http://blog.csdn.net/daryl715/archive/2007/05/09/1602283.aspx我是照這個(gè)例子做的,出的org.apache.axis2.AxisFault: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog,這個(gè)錯誤。弄了2天了。不知道有沒有人理我。  回復(fù)  更多評論   

    # re: 【原創(chuàng)】關(guān)于Web Services以及Axis2技術(shù)(客戶端和服務(wù)器端實(shí)現(xiàn)) 2007-09-30 10:19 zhou

    to wowoer

    我也是照著這個(gè)例子做的,沒有問題,詳細(xì)講一下你的錯誤是什么?  回復(fù)  更多評論   

    # re: 【原創(chuàng)】關(guān)于Web Services以及Axis2技術(shù)(客戶端和服務(wù)器端實(shí)現(xiàn)) 2007-09-30 14:59 wowoer

    org.apache.axis2.AxisFault: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog
    at [row,col {unknown-source}]: [1,0]
    at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:434)
    at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:373)
    at org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:294)
    at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:520)
    at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:500)
    at sample.client.TestClient.main(TestClient.java:29)
      回復(fù)  更多評論   

    # re: 【原創(chuàng)】關(guān)于Web Services以及Axis2技術(shù)(客戶端和服務(wù)器端實(shí)現(xiàn)) 2007-09-30 15:01 wowoer

    這是我的MSN:darlingzhuya@126.com謝謝你幫助我~~  回復(fù)  更多評論   

    # re: 【原創(chuàng)】關(guān)于Web Services以及Axis2技術(shù)(客戶端和服務(wù)器端實(shí)現(xiàn)) 2007-09-30 15:01 wowoer

    我到現(xiàn)在還在解決這個(gè)問題。。。。。郁悶中。。。。  回復(fù)  更多評論   

    # re: 【原創(chuàng)】關(guān)于Web Services以及Axis2技術(shù)(客戶端和服務(wù)器端實(shí)現(xiàn)) 2007-09-30 15:03 wowoer

    to zhou
    今天下班之前,我都會在這里等待!!謝謝你  回復(fù)  更多評論   

    # re: 【原創(chuàng)】關(guān)于Web Services以及Axis2技術(shù)(客戶端和服務(wù)器端實(shí)現(xiàn)) 2007-09-30 15:26 wowoer

    繼續(xù)等待中....  回復(fù)  更多評論   

    # re: 【原創(chuàng)】關(guān)于Web Services以及Axis2技術(shù)(客戶端和服務(wù)器端實(shí)現(xiàn)) 2007-09-30 15:59 wowoer

    完了。。看來十一之前,我的問題都解決不了了。。。。。帶著郁悶過節(jié)。。。  回復(fù)  更多評論   

    # re: 【原創(chuàng)】關(guān)于Web Services以及Axis2技術(shù)(客戶端和服務(wù)器端實(shí)現(xiàn)) 2007-09-30 16:45 wowoer

    我快下班了。。。  回復(fù)  更多評論   

    # re: 【原創(chuàng)】關(guān)于Web Services以及Axis2技術(shù)(客戶端和服務(wù)器端實(shí)現(xiàn)) 2007-09-30 16:51 wowoer

    算了,十一可能沒有機(jī)會上網(wǎng),希望十一回來,可以解決這個(gè)問題。。。謝謝你zhou  回復(fù)  更多評論   

    # re: 【原創(chuàng)】關(guān)于Web Services以及Axis2技術(shù)(客戶端和服務(wù)器端實(shí)現(xiàn)) 2007-10-01 08:42 bsr

    org.apache.axis2.AxisFault: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog
    at [row,col {unknown-source}]: [1,0]
    at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:434)
    at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:373)
    at org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:294)
    at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:520)
    at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:500)
    at sample.client.TestClient.main(TestClient.java:29)
    該錯誤在我關(guān)閉卡巴后消失  回復(fù)  更多評論   

    # re: 【原創(chuàng)】關(guān)于Web Services以及Axis2技術(shù)(客戶端和服務(wù)器端實(shí)現(xiàn)) 2007-10-08 09:15 wowoer

    to bsr: 剛剛上班,我就按照你說的辦法試了,但是還是報(bào)錯,我想,應(yīng)該不是卡巴的問題。。。。不知道還有沒有別的解決辦法?謝謝  回復(fù)  更多評論   

    # re: 【原創(chuàng)】關(guān)于Web Services以及Axis2技術(shù)(客戶端和服務(wù)器端實(shí)現(xiàn)) 2007-10-08 09:20 wowoer

    @bsr
    不好意思,我剛剛是暫停保護(hù),現(xiàn)在完全關(guān)閉,真的就實(shí)現(xiàn)了。。。謝謝。。太詭異了,這個(gè)問題的根源到底是什么??  回復(fù)  更多評論   

    # re: 【原創(chuàng)】關(guān)于Web Services以及Axis2技術(shù)(客戶端和服務(wù)器端實(shí)現(xiàn)) 2008-12-30 15:28 筆仩

    到底是討論AXIS呢,還是討論關(guān)于IP的問題???  回復(fù)  更多評論   

    # re: 【原創(chuàng)】關(guān)于Web Services以及Axis2技術(shù)(客戶端和服務(wù)器端實(shí)現(xiàn)) 2009-08-17 10:07 歐陽

    上傳的文件不完整,打不開,是怎麼回事  回復(fù)  更多評論   


    只有注冊用戶登錄后才能發(fā)表評論。


    網(wǎng)站導(dǎo)航:
     
    <2006年12月>
    262728293012
    3456789
    10111213141516
    17181920212223
    24252627282930
    31123456

    導(dǎo)航

    統(tǒng)計(jì)

    常用鏈接

    留言簿(14)

    隨筆檔案

    BlogJava的幫助

    朋友的博客

    搜索

    最新評論

    閱讀排行榜

    評論排行榜

    快樂工作—享受生活
    主站蜘蛛池模板: 国产精品久久久久久久久久免费| 两个人看的www高清免费视频| 精品成人一区二区三区免费视频| 色哟哟国产精品免费观看 | 精品亚洲麻豆1区2区3区| 亚洲国产午夜精品理论片| 亚洲七久久之综合七久久| 男人和女人高潮免费网站| 久久精品国产免费| 在线观看免费人成视频| 青青青国产色视频在线观看国产亚洲欧洲国产综合 | 99爱视频99爱在线观看免费| 国产桃色在线成免费视频| 免费国产成人午夜电影| 亚洲一区AV无码少妇电影☆| 亚洲无线一二三四区| 老司机福利在线免费观看| 暖暖在线视频免费视频| 亚洲日韩国产精品乱| 亚洲国产成人久久精品影视| 亚洲欧美日韩中文字幕一区二区三区 | 亚洲午夜爱爱香蕉片| 久久久久久久亚洲Av无码| 激情无码亚洲一区二区三区 | 边摸边脱吃奶边高潮视频免费| 99免费在线视频| 啦啦啦中文在线观看电视剧免费版 | 亚洲综合区小说区激情区| 18亚洲男同志videos网站| 国产精品亚洲专一区二区三区| 日本一区二区免费看| 日本免费v片一二三区| 亚洲AV美女一区二区三区| 亚洲AV无码一区二区一二区| 久久久久久免费一区二区三区| 日韩视频免费在线| 亚洲日韩区在线电影| 在线播放免费人成视频网站 | 午夜不卡久久精品无码免费| 国产成人免费福利网站| 久久久亚洲AV波多野结衣|