Showing posts with label Axis2. Show all posts
Showing posts with label Axis2. Show all posts

Tuesday, March 5, 2013

Axis 1.6.1 or Flash Builder 4.6: Unsupported content Simple Content

if you get "log4j:WARN Please initialize the log4j system properly", create the file log4j.properties in C:\apps\axis2-1.6.1 (AXIS_HOME):

log4j.rootLogger=debug, stdout
 
# Direct log messages to stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n

After that I see that by running:
wsdl2java -d adb -uri yourwslduri

I get

2013-03-05 11:41:46 DEBUG ProjectResourceBundle:70 - org.apache.axis2.schema.i18n.resource::handleGe
tObject(schema.unsupportedcontenterror)
Exception in thread "main" org.apache.axis2.wsdl.codegen.CodeGenerationException: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
        at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:293)
        at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35)
        at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24)
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
        at org.apache.axis2.wsdl.codegen.extension.SimpleDBExtension.engage(SimpleDBExtension.java:53)
        at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:246
)
        ... 2 more
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.axis2.wsdl.codegen.extension.SimpleDBExtension.engage(SimpleDBExtension.java:50)
        ... 3 more
Caused by: org.apache.axis2.schema.SchemaCompilationException: Unsupported content Simple Content !
        at org.apache.axis2.schema.SchemaCompiler.copyMetaInfoHierarchy(SchemaCompiler.java:1412)
        at org.apache.axis2.schema.SchemaCompiler.processComplexContent(SchemaCompiler.java:1278)
        at org.apache.axis2.schema.SchemaCompiler.processContentModel(SchemaCompiler.java:1227)
        at org.apache.axis2.schema.SchemaCompiler.processComplexType(SchemaCompiler.java:1171)
        at org.apache.axis2.schema.SchemaCompiler.processNamedComplexSchemaType(SchemaCompiler.java:1091)
        at org.apache.axis2.schema.SchemaCompiler.processSchema(SchemaCompiler.java:1005)
        at org.apache.axis2.schema.SchemaCompiler.processElement(SchemaCompiler.java:644)
        at org.apache.axis2.schema.SchemaCompiler.processElement(SchemaCompiler.java:614)
        at org.apache.axis2.schema.SchemaCompiler.compile(SchemaCompiler.java:422)
        at org.apache.axis2.schema.SchemaCompiler.compile(SchemaCompiler.java:381)
        at org.apache.axis2.schema.SchemaCompiler.compile(SchemaCompiler.java:381)
        at org.apache.axis2.schema.SchemaCompiler.compile(SchemaCompiler.java:381)
        at org.apache.axis2.schema.SchemaCompiler.compile(SchemaCompiler.java:291)
        at org.apache.axis2.schema.ExtensionUtility.invoke(ExtensionUtility.java:102)
        ... 8 more



while if I use -d xmlbeans, all goes fine.

I see this code:
XmlSchemaType type = resolvedSchema.getTypeByName(baseTypeName);

XmlSchemaComplexType complexType = (XmlSchemaComplexType) type;

XmlSchemaContentModel content = complexType.getContentModel();
....
if (content instanceof XmlSchemaSimpleContent) {
   throw new SchemaCompilationException(SchemaCompilerMessages.getMessage("schema.unsupportedcontenterror", "Simple Content"));




This org.apache.axis2.schema.SchemaCompiler is in axis2-adb-codegen-1.6.1.jar

I have downloaded the source code, and added:


 try {
     log.warn("copyMetaInfoHierarchy " + baseTypeName.toString() + " " + parentSchema.toString());
     System.out.println("copyMetaInfoHierarchy " + baseTypeName.toString() + " " + parentSchema.toString());
 }
 catch (Throwable t) {
     log.error("copyMetaInfoHierarchy", t);
     t.printStackTrace();
 }




at the beginning of copyMetaInfoHierarchy (I had also to make sure that parentSchema is declared as org.apache.ws.commons.schema.XmlSchema.

I found out that the offending element is a

  <xsd:complexType name="ItemClassificationCodeType">
    <xsd:simpleContent>
      <xsd:extension base="tns:CodeType" />
    </xsd:simpleContent>
  </xsd:complexType>

  <xsd:complexType name="CodeType">
  
    <xsd:simpleContent>
      <xsd:extension base="xsd:normalizedString">
        <xsd:attribute name="listID" type="xsd:token" use="optional">
        </xsd:attribute>
        <xsd:attribute name="listAgencyID" type="xsd:anyURI" use="optional">
        </xsd:attribute>
      </xsd:extension>
    </xsd:simpleContent>
  </xsd:complexType>
  


I think adb doesn't like the simpleContent http://www.w3schools.com/schema/el_simpleContent.asp, and this is the JIRA issue (July 2012) :
https://issues.apache.org/jira/browse/AXIS2-5357

it looks like even Axis 1.6.2 (April 2012) is not handling this syntax.

I bet my ass that Flash Builder is using Axis2 under the cover



Thursday, February 3, 2011

Failed while installing Axis2 Web Services Core 1.1

I am using Eclipse
Version: 3.6.1
Build id: M20100909-0800

I try to add Axis2 facet to a Web Service project, I get:


Unable to add the follwing facets to project : Axis2 Web Services Core, Axis2 Web Services Extensions

Failed while installing Axis2 Web Services Core 1.1

java.lang.NullPointerException
at org.eclipse.jst.ws.axis2.facet.utils.Axis2RuntimeUtils.getAxis2ServletAdminClass(Axis2RuntimeUtils.java:226)
at org.eclipse.jst.ws.axis2.facet.commands.MergeWEBXMLCommand.getAdmintServletDescriptor(MergeWEBXMLCommand.java:119)
at org.eclipse.jst.ws.axis2.facet.commands.MergeWEBXMLCommand.exexuteOverride(MergeWEBXMLCommand.java:72)
at org.eclipse.jst.ws.axis2.facet.commands.Axis2WebservicesServerCommand.executeOverride(Axis2WebservicesServerCommand.java:134)
at org.eclipse.jst.ws.axis2.facet.deligate.Axis2CoreFacetInstallDelegate.execute(Axis2CoreFacetInstallDelegate.java:43)
at org.eclipse.wst.common.project.facet.core.internal.FacetedProject.callDelegate(FacetedProject.java:1478)
... 8 more



In fact this turns out to be a BUG

https://bugs.eclipse.org/bugs/show_bug.cgi?format=multiple&id=327800



See also


http://www.eclipse.org/forums/index.php?&t=msg&th=62333

To configure the Axis2 runtime:

in Windows/Preferences/Web Services/Axis2 Preferences set the runtime location

Windows/Preferences/Web Services/Server and Runtime/Apache Axis2


Dynamic Web Module should be set to 2.5 - they say.


Guys, this is ridiculous, in Eclipse 3.6 one cannot develop Axis2 Web Services. Simply OBSCENE.

Saturday, June 12, 2010

axis2 EndpointReference

To point your Axis2 client stub to any server:

    private static final String SERVER_NAME = "localhost:7001";

    private static final String TARGET_ENDPOINT = "http://" + SERVER_NAME + "//GEO_OSB_Portal/PS/GeoOsbServicePS";



    /**
     * Return a valid instance of a Stub, ready to invoke methods
     * @return
     * @throws AxisFault
     */
    private GeoOsbServiceStub getStub() throws AxisFault {
        GeoOsbServiceStub stub = new GeoOsbServiceStub();
        EndpointReference targetEpr = new EndpointReference(TARGET_ENDPOINT);
        stub._getServiceClient().setTargetEPR(targetEpr );
        return stub;
    }

Friday, June 11, 2010

WebLogic 11 clientgen and Java Client for a WebLogic Web Service

after having added tons of JARs to the classpath, I still get this error message:

java.lang.IllegalAccessError: tried to access class weblogic/wsee/jaxws/WLSContainer$WLSContainerResolver$1 from class weblogic/wsee/jaxws/WLSContainer$WLSContainerResolver

I give up hopes on clientgen.  I will simply use Axis2 libraries.


http://ws.apache.org/axis2/1_1_1/userguide-creatingclients.html

to get the xmlbeans data binding just run:

cd C:\apps\axis2-1.5.1\bin
wsdl2java.bat -d xmlbeans -uri C:/temp/GEOOSBService.WSDL

Remember first to set AXIS2_HOME to C:\apps\axis2-1.5.1

actually the advantage of using Axis databinding option (no -d xmlbeans, use the default) is that you have only 2 Java files to use:
GeoOsbServiceCallbackHandler.java and
GeoOsbServiceStub.java

I like simplicity!

Saturday, May 22, 2010

OSB, Eclipse and Axis2

If you plan to use Axis2 as a runtime for Web Services clients, remember that you should download axis2-1.4.1, and not the latest release, otherwise you will get :


java.lang.NoClassDefFoundError: org/apache/http/HttpResponseFactory
    at org.apache.axis2.transport.http.SimpleHTTPServer.init(SimpleHTTPServer.java:116)
    at org.apache.axis2.engine.ListenerManager.init(ListenerManager.java:74)
    at org.apache.axis2.context.ConfigurationContext.getListenerManager(ConfigurationContext.java:692)
    at org.apache.axis2.client.ServiceClient.configureServiceClient(ServiceClient.java:163)
    at org.apache.axis2.client.ServiceClient.(ServiceClient.java:143)


All this is very sad. There is never a bloody compatibility check in Java classes and Jars... all the time you must discover which version goes with which by trial and error, exceptions and painful googling for explanations.... I would expect in 2010 a mature language like Java would enforce a standardization on library compatibility...