axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Gainty <mgai...@hotmail.com>
Subject RE: JSR172
Date Mon, 24 Nov 2014 17:20:06 GMT
Please confirm the code below is the SpringServletContextObjectSupplier you are implementing:
/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements. See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership. The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

package org.apache.axis2.extensions.spring.receivers;

import org.apache.axis2.AxisFault;
import org.apache.axis2.ServiceObjectSupplier;
import org.apache.axis2.description.AxisService;
import org.apache.axis2.description.Parameter;
import org.apache.axis2.i18n.Messages;
import org.apache.axis2.transport.http.HTTPConstants;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;

public class SpringServletContextObjectSupplier implements ServiceObjectSupplier {

    private static Log log = LogFactory.getLog(SpringServletContextObjectSupplier.class);

    public static final String SERVICE_SPRING_BEANNAME = "SpringBeanName";

    /**
     * Method getServiceObject that is Spring aware via ServletContext.
     *
     * @param axisService
     * @return Returns Object.
     * @throws AxisFault
     */
    public Object getServiceObject(AxisService axisService) throws AxisFault {
        try {
            // Name of spring aware bean to be injected, taken from services.xml
            // via 'SERVICE_SPRING_BEANNAME ' . The Bean and its properties are pre-configured
            // as normally done in a spring type of way and subsequently loaded by Spring.
            // Axis2 just assumes that the bean is configured and is in the classloader.
            Parameter implBeanParam = axisService.getParameter(SERVICE_SPRING_BEANNAME);
            String beanName = ((String)implBeanParam.getValue()).trim();
            if (beanName != null) {
                Parameter servletConfigParam = axisService.getAxisConfiguration()
                        .getParameter(HTTPConstants.HTTP_SERVLETCONFIG);

                if (servletConfigParam == null) {
                    throw new Exception("Axis2 Can't find ServletConfigParameter");
                }
                Object obj = servletConfigParam.getValue();
                ServletContext servletContext;
                if (obj instanceof ServletConfig) {
                    ServletConfig servletConfig = (ServletConfig)obj;
                    servletContext = servletConfig.getServletContext();
                } else {
                    throw new Exception("Axis2 Can't find ServletConfig");
                }
                ApplicationContext aCtx =
                        WebApplicationContextUtils.getWebApplicationContext(servletContext);
                if (aCtx == null) {
                    log.warn("Axis2 Can't find Spring's ApplicationContext");
                    return null;
                } else if (aCtx.getBean(beanName) == null) {
                    throw new Exception("Axis2 Can't find Spring Bean: " + beanName);
                }
                return aCtx.getBean(beanName);
            } else {
                throw new AxisFault(
                        Messages.getMessage("paramIsNotSpecified", "SERVICE_SPRING_BEANNAME"));
            }
        } catch (Exception e) {
            throw AxisFault.makeFault(e);
        }

    }
}

i could not generate necessary artifacts because of missing classes

import com.avon.mx.reaco.persistence.dto.PalletDTO;import com.avon.mx.reaco.persistence.dto.ShipmentRejectionDTO;import
com.avon.mx.reaco.persistence.dto.WSCartonDTO;import com.avon.mx.reaco.persistence.service.HandHeldPersistanceService;
import com.avon.mx.reaco.services.HandHeldServiceScannerI;

?
Martin Gainty 
______________________________________________ 
                                                                                         
         


Date: Mon, 24 Nov 2014 14:38:14 +0000
From: cdelunasaenz@yahoo.com.mx
To: java-user@axis.apache.org; cdelunasaenz@yahoo.com.mx
Subject: Re: JSR172

BTW I an trying at this moment the getPallets() method...  The calss that generated the WS
is:package com.avon.mx.reaco.services;import java.util.ArrayList;import java.util.List;import
javax.faces.bean.ManagedProperty;import javax.jws.WebMethod;import javax.jws.WebParam;import
javax.jws.WebService;import org.springframework.beans.factory.annotation.Autowired;import
com.avon.mx.reaco.persistence.dto.PalletDTO;import com.avon.mx.reaco.persistence.dto.ShipmentRejectionDTO;import
com.avon.mx.reaco.persistence.dto.WSCartonDTO;import com.avon.mx.reaco.persistence.service.HandHeldPersistanceService;@WebService(serviceName="handHeldScannerService",
           endpointInterface="/handHeldScannerService",            targetNamespace="http://com.xxxx.services")public
class HandHeldScannerService implements HandHeldScannerServiceI {            @Autowired  
 @ManagedProperty(value="#{handHeldService}")    private HandHeldPersistanceService handHeldService;
       @Override    @WebMethod(operationName="getScannedLabels")    public int getScannedLabels(@WebParam(name="labels")String[]
labels) {        return labels.length;    }    @Override    @WebMethod(operationName="getPallets")
   public String[] getPallets( @WebParam(name="shipment") String shipment) {        List<String>
result= new ArrayList<String>();        List<PalletDTO> pallets = new ArrayList<PalletDTO>();
       try{            pallets = handHeldService.getPallets(shipment);        }catch(Exception
exc){            exc.printStackTrace();        }        for(PalletDTO item: pallets){    
       result.add(item.getIdPallet());        }        return (String[])result.toArray();
   }    @Override    @WebMethod(operationName="getCartoons")    public List<WSCartonDTO>
getCartons(@WebParam(name="pallet") String pallet){        List<WSCartonDTO> result=
new ArrayList<WSCartonDTO>();        try{            result = handHeldService.getCartons(pallet);
       }catch(Exception exc){            exc.printStackTrace();        }                return
result;    }        @Override    @WebMethod(operationName="getRejectionCatalog")    public
List<ShipmentRejectionDTO> getRejectionCatalog() {        List<ShipmentRejectionDTO>
result= new ArrayList<ShipmentRejectionDTO>();        try{            result = handHeldService.getRejectionStatusList();
       }catch(Exception exc){            exc.printStackTrace();        }                return
result;    }}And the services.xml contains:<service name="handHeldScannerService"> 
      <description>            Handheld Service        </description>        
        <parameter name="ServiceClass" locked="false">com.avon.mx.reaco.services.HandHeldScannerService
       </parameter>                    <parameter name="ServiceObjectSupplier">org.apache.axis2.extensions.spring.receivers.SpringServletContextObjectSupplier</parameter>
   </service>Thanks in advance and greetingsCarlos de Luna

         De: Carlos de Luna Saenz <cdelunasaenz@yahoo.com.mx>
 Para: "java-user@axis.apache.org" <java-user@axis.apache.org> 
 Enviado: Lunes, 24 de noviembre, 2014 8:26:54
 Asunto: Re: JSR172
   
The client runs in Windows CE CReMe and will be a awt/swing based client. the WTK was used
to generate the JSR172 stubs but (as i mentioned) there has been other "stubs generators"
used and all with the same result. the JDK for JME 3.4 and even the one from JMe 8 was used
as well as the NetBeans 8 was included. The WSDL generated by the service by axis is:<wsdl:definitions
targetNamespace="http://com.avon.services">    <wsdl:documentation>handHeldScannerService</wsdl:documentation>
   <wsdl:types>    <xs:schema attributeFormDefault="qualified" elementFormDefault="qualified"
targetNamespace="http://dto.persistence.reaco.mx.xxxx.com/xsd">       <xs:complexType
name="ShipmentRejectionDTO">          <xs:sequence>             <xs:element minOccurs="0"
name="description" nillable="true" type="xs:string"/>             <xs:element minOccurs="0"
name="id" type="xs:long"/>          </xs:sequence>       </xs:complexType>
      <xs:complexType name="WSCartonDTO">          <xs:sequence>             <xs:element
maxOccurs="unbounded" minOccurs="0" name="bags" nillable="true" type="ax29:WSBagDTO"/>
            <xs:element minOccurs="0" name="campaign" nillable="true" type="xs:string"/>
            <xs:element minOccurs="0" name="idCarton" nillable="true" type="xs:string"/>
            <xs:element maxOccurs="unbounded" minOccurs="0" name="products" nillable="true"
type="ax29:WSProductDTO"/>             <xs:element minOccurs="0" name="zone" nillable="true"
type="xs:string"/>          </xs:sequence>      </xs:complexType>      <xs:complexType
name="WSBagDTO">          <xs:sequence>            <xs:element minOccurs="0" name="idBag"
nillable="true" type="xs:string"/>            <xs:element maxOccurs="unbounded" minOccurs="0"
name="products" nillable="true" type="ax29:WSProductDTO"/>          </xs:sequence>
     </xs:complexType>      <xs:complexType name="WSProductDTO">          <xs:sequence>
           <xs:element minOccurs="0" name="fsc" nillable="true" type="xs:string"/> 
          <xs:element minOccurs="0" name="quantity" type="xs:int"/>          </xs:sequence>
      </xs:complexType>    </xs:schema>    <xs:schema attributeFormDefault="qualified"
elementFormDefault="qualified" targetNamespace="http://com.xxx.services">        <xs:import
namespace="http://dto.persistence.reaco.mx.xxx.com/xsd"/>            <xs:element name="getScannedLabels">
               <xs:complexType>                    <xs:sequence>             
          <xs:element maxOccurs="unbounded" minOccurs="0" name="labels" nillable="true"
type="xs:string"/>                    </xs:sequence>                </xs:complexType>
           </xs:element>            <xs:element name="getScannedLabelsResponse">
               <xs:complexType>                    <xs:sequence>             
          <xs:element minOccurs="0" name="return" type="xs:int"/>                  
 </xs:sequence>                </xs:complexType>            </xs:element>
           <xs:element name="getRejectionCatalog">                <xs:complexType>
                   <xs:sequence/>                </xs:complexType>           
</xs:element>            <xs:element name="getRejectionCatalogResponse">     
          <xs:complexType>                <xs:sequence>                    <xs:element
maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="ax29:ShipmentRejectionDTO"/>
               </xs:sequence>            </xs:complexType>        </xs:element>
       <xs:element name="getPallets">            <xs:complexType>            
   <xs:sequence>                    <xs:element minOccurs="0" name="shipment" nillable="true"
type="xs:string"/>                </xs:sequence>            </xs:complexType>
       </xs:element>        <xs:element name="getPalletsResponse">           
<xs:complexType>                <xs:sequence>                    <xs:element
maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="xs:string"/>  
             </xs:sequence>            </xs:complexType>        </xs:element>
       <xs:element name="getCartons">            <xs:complexType>            
   <xs:sequence>                    <xs:element minOccurs="0" name="pallet" nillable="true"
type="xs:string"/>                </xs:sequence>            </xs:complexType>
       </xs:element>        <xs:element name="getCartonsResponse">           
<xs:complexType>                <xs:sequence>                    <xs:element
maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="ax29:WSCartonDTO"/>
               </xs:sequence>            </xs:complexType>        </xs:element>
   </xs:schema>    </wsdl:types>        <wsdl:message name="getRejectionCatalogRequest">
           <wsdl:part name="parameters" element="ns:getRejectionCatalog"/>        </wsdl:message>
       <wsdl:message name="getRejectionCatalogResponse">            <wsdl:part name="parameters"
element="ns:getRejectionCatalogResponse"/>        </wsdl:message>        <wsdl:message
name="getScannedLabelsRequest">            <wsdl:part name="parameters" element="ns:getScannedLabels"/>
       </wsdl:message>        <wsdl:message name="getScannedLabelsResponse"> 
          <wsdl:part name="parameters" element="ns:getScannedLabelsResponse"/>     
  </wsdl:message>        <wsdl:message name="getPalletsRequest">          <wsdl:part
name="parameters" element="ns:getPallets"/>        </wsdl:message>        <wsdl:message
name="getPalletsResponse">          <wsdl:part name="parameters" element="ns:getPalletsResponse"/>
       </wsdl:message>        <wsdl:message name="getCartonsRequest">        
   <wsdl:part name="parameters" element="ns:getCartons"/>        </wsdl:message>
       <wsdl:message name="getCartonsResponse">            <wsdl:part name="parameters"
element="ns:getCartonsResponse"/>        </wsdl:message>        <wsdl:portType
name="handHeldScannerServicePortType">          <wsdl:operation name="getRejectionCatalog">
         <wsdl:input message="ns:getRejectionCatalogRequest" wsaw:Action="urn:getRejectionCatalog"/>
         <wsdl:output message="ns:getRejectionCatalogResponse" wsaw:Action="urn:getRejectionCatalogResponse"/>
       </wsdl:operation>        <wsdl:operation name="getScannedLabels">     
    <wsdl:input message="ns:getScannedLabelsRequest" wsaw:Action="urn:getScannedLabels"/>
         <wsdl:output message="ns:getScannedLabelsResponse" wsaw:Action="urn:getScannedLabelsResponse"/>
       </wsdl:operation>        <wsdl:operation name="getPallets">          <wsdl:input
message="ns:getPalletsRequest" wsaw:Action="urn:getPallets"/>          <wsdl:output
message="ns:getPalletsResponse" wsaw:Action="urn:getPalletsResponse"/>        </wsdl:operation>
       <wsdl:operation name="getCartons">          <wsdl:input message="ns:getCartonsRequest"
wsaw:Action="urn:getCartons"/>          <wsdl:output message="ns:getCartonsResponse"
wsaw:Action="urn:getCartonsResponse"/>        </wsdl:operation>        </wsdl:portType>
       <wsdl:binding name="handHeldScannerServiceSoap11Binding" type="ns:handHeldScannerServicePortType">
         <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
       <wsdl:operation name="getRejectionCatalog">          <soap:operation soapAction="urn:getRejectionCatalog"
style="document"/>            <wsdl:input>                <soap:body use="literal"/>
           </wsdl:input>            <wsdl:output>                <soap:body
use="literal"/>            </wsdl:output>        </wsdl:operation>        <wsdl:operation
name="getPallets">            <soap:operation soapAction="urn:getPallets" style="document"/>
           <wsdl:input>                <soap:body use="literal"/>            </wsdl:input>
           <wsdl:output>                <soap:body use="literal"/>           
</wsdl:output>        </wsdl:operation>        <wsdl:operation name="getScannedLabels">
           <soap:operation soapAction="urn:getScannedLabels" style="document"/>    
       <wsdl:input>                <soap:body use="literal"/>            </wsdl:input>
           <wsdl:output>                <soap:body use="literal"/>           
</wsdl:output>        </wsdl:operation>        <wsdl:operation name="getCartons">
           <soap:operation soapAction="urn:getCartons" style="document"/>          
 <wsdl:input>                <soap:body use="literal"/>            </wsdl:input>
           <wsdl:output>                <soap:body use="literal"/>           
</wsdl:output>        </wsdl:operation>    </wsdl:binding>    <wsdl:binding
name="handHeldScannerServiceSoap12Binding" type="ns:handHeldScannerServicePortType">  
     <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
       <wsdl:operation name="getRejectionCatalog">            <soap12:operation soapAction="urn:getRejectionCatalog"
style="document"/>            <wsdl:input>                <soap12:body use="literal"/>
           </wsdl:input>            <wsdl:output>                <soap12:body
use="literal"/>            </wsdl:output>        </wsdl:operation>        <wsdl:operation
name="getPallets">            <soap12:operation soapAction="urn:getPallets" style="document"/>
           <wsdl:input>                <soap12:body use="literal"/>          
 </wsdl:input>            <wsdl:output>                <soap12:body use="literal"/>
           </wsdl:output>        </wsdl:operation>        <wsdl:operation name="getScannedLabels">
           <soap12:operation soapAction="urn:getScannedLabels" style="document"/>  
         <wsdl:input>                <soap12:body use="literal"/>            </wsdl:input>
           <wsdl:output>                <soap12:body use="literal"/>         
  </wsdl:output>        </wsdl:operation>        <wsdl:operation name="getCartons">
           <soap12:operation soapAction="urn:getCartons" style="document"/>        
   <wsdl:input>                <soap12:body use="literal"/>            </wsdl:input>
           <wsdl:output>                <soap12:body use="literal"/>         
  </wsdl:output>        </wsdl:operation>    </wsdl:binding>    <wsdl:binding
name="handHeldScannerServiceHttpBinding" type="ns:handHeldScannerServicePortType">    
   <http:binding verb="POST"/>        <wsdl:operation name="getRejectionCatalog">
           <http:operation location="getRejectionCatalog"/>            <wsdl:input>
               <mime:content type="application/xml" part="parameters"/>            </wsdl:input>
           <wsdl:output>                <mime:content type="application/xml" part="parameters"/>
           </wsdl:output>        </wsdl:operation>        <wsdl:operation name="getPallets">
           <http:operation location="getPallets"/>            <wsdl:input>   
            <mime:content type="application/xml" part="parameters"/>            </wsdl:input>
           <wsdl:output>                <mime:content type="application/xml" part="parameters"/>
           </wsdl:output>        </wsdl:operation>        <wsdl:operation name="getScannedLabels">
           <http:operation location="getScannedLabels"/>            <wsdl:input>
               <mime:content type="application/xml" part="parameters"/>            </wsdl:input>
           <wsdl:output>                <mime:content type="application/xml" part="parameters"/>
           </wsdl:output>        </wsdl:operation>        <wsdl:operation name="getCartons">
           <http:operation location="getCartons"/>            <wsdl:input>   
            <mime:content type="application/xml" part="parameters"/>            </wsdl:input>
           <wsdl:output>                <mime:content type="application/xml" part="parameters"/>
           </wsdl:output>        </wsdl:operation>    </wsdl:binding>  
 <wsdl:service name="handHeldScannerService">        <wsdl:port name="handHeldScannerServiceHttpSoap11Endpoint"
binding="ns:handHeldScannerServiceSoap11Binding">            <soap:address location="http://mxxxxxx1234.sa.xxxx.net:8080/reaco_v3/services/handHeldScannerService.handHeldScannerServiceHttpSoap11Endpoint/"/>
       </wsdl:port>        <wsdl:port name="handHeldScannerServiceHttpSoap12Endpoint"
binding="ns:handHeldScannerServiceSoap12Binding">            <soap12:address location="http://mxbdelunaca1234.sa.xxxxx.net:8080/reaco_v3/services/handHeldScannerService.handHeldScannerServiceHttpSoap12Endpoint/"/>
       </wsdl:port>        <wsdl:port name="handHeldScannerServiceHttpEndpoint" binding="ns:handHeldScannerServiceHttpBinding">
           <http:address location="http://mxbdelunaca1234.sa.xxxx.net:8080/reaco_v3/services/handHeldScannerService.handHeldScannerServiceHttpEndpoint/"/>
       </wsdl:port>    </wsdl:service></wsdl:definitions>The generated stubs
are being ziped in the ataqchment         De: Martin Gainty <mgainty@hotmail.com> Para:
"java-user@axis.apache.org" <java-user@axis.apache.org>  Enviado: Viernes, 21 de noviembre,
2014 14:24:32 Asunto: RE: JSR172   I guess I dont undestand why you are using Wireless Tooklkit
to generate stubs from wsdl..can you explain?the error means that the response contains an
element which is not documented in any of the XSDs you are referencing ORthe element in the
response is of the wrong type xs:string en vez de matriz de string por ejemplo<wsdl:definitions
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"xmlns:xs="http://www.w3.org/2001/XMLSchema"xmlns:ns="http://complex.tempuri.org"....>
   <xs:complexType name="ArrayOfstring">                <xs:sequence>        
           <xs:element maxOccurs="unbounded" minOccurs="0" name="string" nillable="true"
type="xs:string"/>                </xs:sequence>            </xs:complexType>
    <xs:element name="retArrayString1DResponse">                <xs:complexType>
                   <xs:sequence>                        <xs:element minOccurs="0"
name="return" nillable="true" type="ns:ArrayOfstring"/>                    </xs:sequence>
               </xs:complexType>            </xs:element>    <wsdl:message
name="retArrayString1DResponse">        <wsdl:part name="parameters" element="ns:retArrayString1DResponse"/>
   </wsdl:message>        <wsdl:operation name="retArrayString1D">           
<wsdl:input message="ns:retArrayString1DRequest" wsaw:Action="urn:retArrayString1D"/>
           <wsdl:output message="ns:retArrayString1DResponse" wsaw:Action="urn:retArrayString1DResponse"/>
       </wsdl:operation></wsdl>Post the WSDL and we will generate the service
and client stubs hereSaludosMartinDate: Fri, 21 Nov 2014 18:47:15 +0000From: cdelunasaenz@yahoo.com.mxTo:
java-user@axis.apache.orgSubject: JSR172I am working to build an application that will connect
to a JME app, the application will consume webservices, the webservice returns an String[]
value but is not being readed well at the client side weither with stubs maden wth NetBeans
8, JME 3 wsdlcomiple nor wtk 2.5.2_01the message on the exception says that is there a Invalid
element on the response... ┬┐Someone has any idea on how to correct this? Axis 2 is in use
with tomacat and Spring...final release will be made on WebSphere 8...Greetings and thanks
in advance 		 	   		       
---------------------------------------------------------------------To unsubscribe, e-mail:
java-user-unsubscribe@axis.apache.orgFor additional commands, e-mail: java-user-help@axis.apache.org

      		 	   		  
Mime
View raw message