0

Windows 7 で従来の apache axis 1.4 Java プログラムを維持しています。私のプログラムの出力は次のとおりです。EffectiveDate Fri Mar 01 00:00:00 EDT 2013

日付を「YYYY-MM-DD」(「2013-03-01」など) として返すように Apache 軸を作成するにはどうすればよいですか? つまり、java.util.Date (例: "Fri Mar 01 00:00:00 EDT 2013") を入力として受け取り、"YYYY-MM-DD" (例: "2013-03-01") を返すヘルパー関数を記述しないでください。 )。

私のプログラム(主なロジックを示すために簡略化):

private Call call;
Service service = new Service();

try{
        call = (Call) service.createCall();

         //...

        // Create Header
        SOAPHeaderElement1 = createApplicationHeader1(mainForm.getTransactionIdentifier() + "-" + threadNumber,
                                                      mainForm.getUserName(),
                                                      mainForm.getUserPassword());
        call.addHeader(SOAPHeaderElement1);
}catch(ServiceException se){
         //...
}

try{
        call.setTargetEndpointAddress(new java.net.URL(endPoint));
        call.setOperationName("getInfo");

        //...
        rpcBodyElement = new RPCElement("getInfo");
        rpcBodyElement.setEncodingStyle("http://schemas.xmlsoap.org/soap/encoding/");
        rpcBodyElement.setNamespaceURI(bnwsdl);

        SOAPElement getInfoElement = rpcBodyElement.addChildElement(INFO_GET_REQUEST);
        SOAPElement typeCode = getInfoElement.addChildElement(TYPE_CODE);
        typeCode.addTextNode(mainForm.getTypeCode());

        call.setReturnType(new javax.xml.namespace.QName("http://www.mytest.com/xml_schemas/ws", "InfoGetResponseType"));
        call.setReturnClass(com.mytest.www.ws.common.InfoGetResponseType.class);
        call.setReturnQName(new javax.xml.namespace.QName("", "getInfoReturn"));

        QName qname = new QName( "http://www.mytest.com/xml_schemas/ws", "InfoGetResponseType" );
        call.registerTypeMapping(com.mytest.www.ws.common.InfoGetResponseType.class,
              qname,
              new org.apache.axis.encoding.ser.BeanSerializerFactory(com.mytest.www.ws.common.InfoGetResponseType.class, qname),
              new org.apache.axis.encoding.ser.BeanDeserializerFactory(com.mytest.www.ws.common.InfoGetResponseType.class, qname), false);

        // Invoke Web Service
        infoGetResponse = (com.mytest.www.ws.common.InfoGetResponseType) call.invoke(rpcBodyElement);
        System.out.println("EffectiveDate " + infoGetResponse.getInfoResultRow().getEffectiveDate());
}catch (MalformedURLException mue){
        //...
}
4

0 に答える 0