2015-02-11 38 views
0

我會盡量簡單地解釋一下。在已經實現的Axis請求中添加一個新字段

我需要在一個名爲shipToStoreGLN的新字段中使用WSDL描述符很早以前實現的Axis請求。

它出現在路徑OrderRequest - > PedidosIn(OrdersIn) - > Pedido(訂單) - > Cabecera(報頭)

我tryed添加的場像任何其他字段被添加,但它不沒有工作,它沒有出現在最終的要求中。

更奇怪的是,還有另一個字段叫做shipToStore它已添加到類中,但未添加到類型描述中,但它出現在最終請求上。

有人可以告訴我如何添加該字段,如果可能的話,解釋爲什麼其他字段出現?

我將粘貼代碼,請求的外觀以及它現在的樣子。

感謝大家。

相關代碼的類OrderRequestPedidosInPedidoCabecera.java(我不能夠複製完整的Java源,因爲它太長)的

//The getters and setters 
public java.lang.String getShipToStoreGLN() { 
    return shipToStoreGLN; 
} 

public void setShipToStoreGLN(java.lang.String shipToStoreGLN) { 
    this.shipToStoreGLN = shipToStoreGLN; 
} 

//Applying it to the type descriptor 
elemField = new org.apache.axis.description.ElementDesc(); 
elemField.setFieldName("shipToStoreGLN"); 
elemField.setXmlName(new javax.xml.namespace.QName("http://tempuri.org/GatewayService/", "shipToStoreGLN")); 
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string")); 
elemField.setMinOccurs(0); 
elemField.setNillable(false); 
typeDesc.addFieldDesc(elemField); 

的存根上的要求如何有看起來像:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:gat="http://tempuri.org/GatewayService/"> 
    <soapenv:Header/> 
    <soapenv:Body> 
     <gat:OrderRequest> 
     <gat:PedidosIn> 
      <gat:Identificacion> 
       <gat:IdUsuario>?</gat:IdUsuario> 
       <gat:Password>?</gat:Password> 
      </gat:Identificacion> 
      <gat:Pedido> 
       <gat:Cabecera> 
        <gat:NumeroPedido>?</gat:NumeroPedido> 
        <gat:shipToStore>?</gat:shipToStore> 
        <gat:shipToStoreGLN>?</gat:shipToStoreGLN> 
        <gat:FechaPedido>?</gat:FechaPedido> 
        <gat:Facturacion> 
        <gat:Nombre>?</gat:Nombre> 
        <gat:Apellidos>?</gat:Apellidos> 
        <gat:Direccion>?</gat:Direccion> 
        <gat:CodigoPostal>?</gat:CodigoPostal> 
        <gat:Poblacion>?</gat:Poblacion> 
        <gat:Provincia>?</gat:Provincia> 
        <gat:NIF>?</gat:NIF> 
        <gat:Telefono>?</gat:Telefono> 
        </gat:Facturacion> 
        <gat:Entrega> 
        <gat:Nombre>?</gat:Nombre> 
        <gat:Apellidos>?</gat:Apellidos> 
        <gat:Direccion>?</gat:Direccion> 
        <gat:CodigoPostal>?</gat:CodigoPostal> 
        <gat:Poblacion>?</gat:Poblacion> 
        <gat:Provincia>?</gat:Provincia> 
        <gat:NIF>?</gat:NIF> 
        <gat:Telefono>?</gat:Telefono> 
        </gat:Entrega> 
        <gat:Total>?</gat:Total> 
        <gat:Email>?</gat:Email> 
        <gat:CodigoTrackingTrans>?</gat:CodigoTrackingTrans> 
        <gat:NumeroExpedicion>?</gat:NumeroExpedicion> 
        <gat:CodigoRuta>?</gat:CodigoRuta> 
        <gat:NombreRuta>?</gat:NombreRuta> 
        <gat:CodigoAgenciaDestino>?</gat:CodigoAgenciaDestino> 
        <gat:NombreAgenciaDestino>?</gat:NombreAgenciaDestino> 
       </gat:Cabecera> 
       <gat:Lineas> 
        <!--Zero or more repetitions:--> 
        <gat:Linea> 
        <gat:IdPedidoLinea>?</gat:IdPedidoLinea> 
        <gat:Referencia>?</gat:Referencia> 
        <gat:ReferenciaMS>?</gat:ReferenciaMS> 
        <gat:Posicion>?</gat:Posicion> 
        <gat:Cantidad>?</gat:Cantidad> 
        <gat:Descripcion>?</gat:Descripcion> 
        <gat:PrecioUnitario>?</gat:PrecioUnitario> 
        <gat:Total>?</gat:Total> 
        </gat:Linea> 
       </gat:Lineas> 
      </gat:Pedido> 
     </gat:PedidosIn> 
     </gat:OrderRequest> 
    </soapenv:Body> 
</soapenv:Envelope> 

如何請求貌似現在:

<soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> 
    <OrderRequest xmlns="http://tempuri.org/GatewayService/"> 
     <PedidosIn> 
      <Identificacion> 
       <IdUsuario>MMKTTEST</IdUsuario> 
       <Password>H23mLu3RieDr</Password> 
      </Identificacion> 
      <Pedido> 
       <Cabecera> 
        <NumeroPedido>00</NumeroPedido> 
        <FechaPedido>20140911 122523</FechaPedido> 
        <CodigoTiendaFacturacion>E290</CodigoTiendaFacturacion> 
        <CodigoTiendaEntrega>E290</CodigoTiendaEntrega> 
        <Facturacion> 
         <Nombre>Cristina</Nombre> 
         <Apellidos>Franco</Apellidos> 
         <Direccion>barcelona,gggg gggg</Direccion> 
         <CodigoPostal>08022</CodigoPostal> 
         <Poblacion>BARCELONA</Poblacion> 
         <Provincia>BARCELONA</Provincia> 
         <CodigoProvincia>08</CodigoProvincia> 
         <NIF>52173198K</NIF> 
         <Telefono>677714997</Telefono> 
         <pais>es</pais> 
        </Facturacion> 
        <Entrega> 
         <Nombre>MEDIA MARKT DIAGONAL MAR-BARCELONA VIDEO-TV-HIFI-E</Nombre> 
         <Apellidos>LEKTRO-COMPUTER-FOTO, S.A </Apellidos> 
         <Direccion>C.C DIAGONAL MAR AVDA DIAGONAL N&#xBA;3, planta B local 14000</Direccion> 
         <CodigoPostal>08019</CodigoPostal> 
         <Poblacion>BARCELONA</Poblacion> 
         <Provincia>BARCELONA</Provincia> 
         <NIF/> 
         <Telefono>934857200</Telefono> 
         <direccion1>C.C DIAGONAL MAR AVDA DIAGONAL N&#xBA;3, planta B local 14000</direccion1> 
         <direccion2/> 
         <direccion3/> 
        </Entrega> 
        <Total>219.0</Total> 
        <Email>[email protected]</Email> 
        <CodigoTrackingTrans/> 
        <NumeroExpedicion/> 
        <CodigoRuta/> 
        <NombreRuta/> 
        <CodigoAgenciaDestino/> 
        <NombreAgenciaDestino/> 
        <shipToStore>1</shipToStore> 
       </Cabecera> 
       <Lineas> 
        <Linea> 
         <IdPedidoLinea>0</IdPedidoLinea> 
         <Referencia>B99B329</Referencia> 
         <ReferenciaMS>1148842</ReferenciaMS> 
         <ReferenciaUni/> 
         <Posicion>1</Posicion> 
         <Cantidad>1.0</Cantidad> 
         <Descripcion>GF EN210 SILENT/DI/1GD3/V2  CTLR 1GB DDR3 PCI-E DVI-I HDMI  IN</Descripcion> 
         <PrecioUnitario>0.0</PrecioUnitario> 
         <Total>0.0</Total> 
        </Linea> 
       </Lineas> 
      </Pedido> 
     </PedidosIn> 
    </OrderRequest> 
</soapenv:Body> 
+0

相關**代碼**(我無法粘貼完整的java源代碼,因爲它太長了): – 2015-02-11 10:51:20

回答

0

我正在設置null on shipToStoreGLN字段。現在我知道你不能設置null,並期望XML標籤出現。

相關問題