You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Tony Dean <To...@sas.com> on 2005/08/10 23:29:29 UTC

[AXIS2] Admin Tools

Hi,

I'm trying to prototype a couple of things with the axis2 engine to see how it works (I down loaded 0.9).  In particular, I want to start with a wsdl and generate the necessary artifacts.  I'd like to do this from a web service (e.g. use a web service to generate other web services).  I can generate the wsdl on the fly.  Can I then use your org.apache.axis2.deployment classes to generate the artifacts and then hot deploy them in the current engine on the server?  Are the admin classes ready to be poked?  I didn't see any samples and the javadoc is sparse in this area.  Do you still have the notion of jws file in axis2?  I didn't know if that was still an alternative to generating the wsdl.

I also want to include attachments in my generated web services.  I took the doc-lit SwA sample from WS-I BP Attachment document and tried to use wsdl2java to create the service deployment code and I'm getting the following error:

Exception in thread "main" java.lang.RuntimeException: org.apache.xmlbeans.XmlException: error: cvc-complex-type.2.4a: Expected elements 'annotation@http://www.w3.org/2001/XMLSchema simpleType@http://
www.w3.org/2001/XMLSchema complexType@http://www.w3.org/2001/XMLSchema group@http://www.w3.org/2001/XMLSchema attributeGroup@http://www.w3.org/2001/XMLSchema element@http://www.w3.org/2001/XMLSchema a
ttribute@http://www.w3.org/2001/XMLSchema notation@http://www.w3.org/2001/XMLSchema' instead of 'complexType' here in element schema@http://www.w3.org/2001/XMLSchema
        at org.apache.axis2.wsdl.codegen.extension.XMLBeansExtension.engage(XMLBeansExtension.java:103)
        at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:79)
        at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:28)
        at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:22)
Caused by: org.apache.xmlbeans.XmlException: error: cvc-complex-type.2.4a: Expected elements 'annotation@http://www.w3.org/2001/XMLSchema simpleType@http://www.w3.org/2001/XMLSchema complexType@http:/
/www.w3.org/2001/XMLSchema group@http://www.w3.org/2001/XMLSchema attributeGroup@http://www.w3.org/2001/XMLSchema element@http://www.w3.org/2001/XMLSchema attribute@http://www.w3.org/2001/XMLSchema no
tation@http://www.w3.org/2001/XMLSchema' instead of 'complexType' here in element schema@http://www.w3.org/2001/XMLSchema
        at org.apache.xmlbeans.impl.schema.SchemaTypeSystemCompiler.compile(SchemaTypeSystemCompiler.java:225)
        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:324)
        at org.apache.xmlbeans.XmlBeans.compileXmlBeans(XmlBeans.java:641)
        at org.apache.axis2.wsdl.codegen.extension.XMLBeansExtension.engage(XMLBeansExtension.java:69)
        ... 3 more

It seems to not like attachment types of "base64Binary".  Are you aware of this problem?

Here's the wsdl from the WS-I page:

<?xml version="1.0" encoding="utf-8" ?> 
<wsdl:definitions xmlns:types="http://example.com/mimetypes"
                  xmlns:ref="http://ws-i.org/profiles/basic/1.1/xsd"
                  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                  xmlns:soapbind="http://schemas.xmlsoap.org/wsdl/soap/"
                  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
                  xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
                  targetNamespace="http://example.com/mimewsdl"
                  xmlns:tns="http://example.com/mimewsdl">

    <wsdl:types>
        <xsd:schema targetNamespace="http://example.com/mimetypes"
                xmlns:xsd="http://www.w3.org/2001/XMLSchema">

            <xsd:import namespace="http://ws-i.org/profiles/basic/1.1/xsd" />
            <xsd:element name="ClaimDetail" type="types:ClaimDetailType"/>
            <xsd:complexType name="ClaimDetailType">
                <xsd:sequence>
                    <xsd:element name="Name" type="xsd:string"/>
                    <xsd:element name="ClaimForm" type="ref:swaRef"/>
                </xsd:sequence>
            </xsd:complexType>
            <xsd:element name="ClaimRefNo" type="xsd:string"/>
        </xsd:schema>
    </wsdl:types>

    <wsdl:message name="ClaimIn">
        <wsdl:part name="body" element="types:ClaimDetail"/>
        <wsdl:part name="ClaimPhoto" type="xsd:base64Binary"/>
    </wsdl:message>

    <wsdl:message name="ClaimOut">
        <wsdl:part name="out" element="types:ClaimRefNo"/>
    </wsdl:message>

    <wsdl:portType name="ClaimPortType">
        <wsdl:operation name="SendClaim">
            <wsdl:input message="tns:ClaimIn"/>
            <wsdl:output message="tns:ClaimOut"/>
        </wsdl:operation>
    </wsdl:portType>

    <wsdl:binding name="ClaimBinding" type="tns:ClaimPortType">
        <soapbind:binding style="document" 
                          transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="SendClaim">
            <soapbind:operation soapAction="http://example.com/soapaction"/>
            <wsdl:input>
                <mime:multipartRelated>
                    <mime:part>
                        <soapbind:body parts="body" use="literal"/>
                    </mime:part>
                    <mime:part>
                        <mime:content part="ClaimPhoto" type="image/jpeg"/>
                    </mime:part>
                </mime:multipartRelated>
            </wsdl:input>
            <wsdl:output>
                <soapbind:body use="literal" />
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
</wsdl:definitions>

Thank you for your efforts.


Tony Dean
SAS Institute Inc.
919.531.6704
tony.dean@sas.com

SAS... The Power to Know
http://www.sas.com


Re: [AXIS2] Admin Tools

Posted by Ajith Ranabahu <aj...@gmail.com>.
Hi Tony,
To me it seems that you need to run the code generator on the fly, compile 
the code and then host a service.(all within some code)
Here are some hints that you'll find useful.
1. Code generator can be easily invoked programmatically. See the 
WSDL2JavaTest.java in the wsdl module for an example.
2. Once the classes are available, you can host the service programmatically 
(by invoking the deployment) or for an easier solution generate a service 
archive and copy it to the repositiry directory.

We still don't have anything resembling jws yet.

Hmmm... Seems to me that XMLBeans finds something confusing in the schema 
part. I will check, thanks for pointing out the problem


On 8/11/05, Tony Dean <To...@sas.com> wrote:
> 
> Hi,
> 
> I'm trying to prototype a couple of things with the axis2 engine to see 
> how it works (I down loaded 0.9). In particular, I want to start with a 
> wsdl and generate the necessary artifacts. I'd like to do this from a web 
> service (e.g. use a web service to generate other web services). I can 
> generate the wsdl on the fly. Can I then use your 
> org.apache.axis2.deployment classes to generate the artifacts and then hot 
> deploy them in the current engine on the server? Are the admin classes ready 
> to be poked? I didn't see any samples and the javadoc is sparse in this 
> area. Do you still have the notion of jws file in axis2? I didn't know if 
> that was still an alternative to generating the wsdl.
> 
> I also want to include attachments in my generated web services. I took 
> the doc-lit SwA sample from WS-I BP Attachment document and tried to use 
> wsdl2java to create the service deployment code and I'm getting the 
> following error:
> 
> Exception in thread "main" java.lang.RuntimeException: 
> org.apache.xmlbeans.XmlException: error: cvc-complex-type.2.4a: Expected 
> elements 'annotation@http://www.w3.org/2001/XMLSchema simpleType@http://
> www.w3.org/2001/XMLSchema <http://www.w3.org/2001/XMLSchema> complexType@
> http://www.w3.org/2001/XMLSchema group@http://www.w3.org/2001/XMLSchema 
> attributeGroup@http://www.w3.org/2001/XMLSchema element@
> http://www.w3.org/2001/XMLSchema a
> ttribute@http://www.w3.org/2001/XMLSchema notation@
> http://www.w3.org/2001/XMLSchema' instead of 'complexType' here in element 
> schema@http://www.w3.org/2001/XMLSchema
> at org.apache.axis2.wsdl.codegen.extension.XMLBeansExtension.engage(
> XMLBeansExtension.java:103)
> at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(
> CodeGenerationEngine.java:79)
> at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:28)
> at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:22)
> Caused by: org.apache.xmlbeans.XmlException: error: cvc-complex-type.2.4a: 
> Expected elements 'annotation@http://www.w3.org/2001/XMLSchema simpleType@
> http://www.w3.org/2001/XMLSchema complexType@http:/
> /www.w3.org/2001/XMLSchema group@http://www.w3.org/2001/XMLSchema 
> attributeGroup@http://www.w3.org/2001/XMLSchema element@
> http://www.w3.org/2001/XMLSchema attribute@
> http://www.w3.org/2001/XMLSchema no
> tation@http://www.w3.org/2001/XMLSchema' instead of 'complexType' here in 
> element schema@http://www.w3.org/2001/XMLSchema
> at org.apache.xmlbeans.impl.schema.SchemaTypeSystemCompiler.compile(
> SchemaTypeSystemCompiler.java:225)
> 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:324)
> at org.apache.xmlbeans.XmlBeans.compileXmlBeans(XmlBeans.java:641)
> at org.apache.axis2.wsdl.codegen.extension.XMLBeansExtension.engage(
> XMLBeansExtension.java:69)
> ... 3 more
> 
> It seems to not like attachment types of "base64Binary". Are you aware of 
> this problem?
> 
> Here's the wsdl from the WS-I page:
> 
> <?xml version="1.0" encoding="utf-8" ?>
> <wsdl:definitions xmlns:types="http://example.com/mimetypes"
> xmlns:ref="http://ws-i.org/profiles/basic/1.1/xsd"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:soapbind="http://schemas.xmlsoap.org/wsdl/soap/"
> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
> targetNamespace="http://example.com/mimewsdl"
> xmlns:tns="http://example.com/mimewsdl">
> 
> <wsdl:types>
> <xsd:schema targetNamespace="http://example.com/mimetypes"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> 
> <xsd:import namespace="http://ws-i.org/profiles/basic/1.1/xsd" />
> <xsd:element name="ClaimDetail" type="types:ClaimDetailType"/>
> <xsd:complexType name="ClaimDetailType">
> <xsd:sequence>
> <xsd:element name="Name" type="xsd:string"/>
> <xsd:element name="ClaimForm" type="ref:swaRef"/>
> </xsd:sequence>
> </xsd:complexType>
> <xsd:element name="ClaimRefNo" type="xsd:string"/>
> </xsd:schema>
> </wsdl:types>
> 
> <wsdl:message name="ClaimIn">
> <wsdl:part name="body" element="types:ClaimDetail"/>
> <wsdl:part name="ClaimPhoto" type="xsd:base64Binary"/>
> </wsdl:message>
> 
> <wsdl:message name="ClaimOut">
> <wsdl:part name="out" element="types:ClaimRefNo"/>
> </wsdl:message>
> 
> <wsdl:portType name="ClaimPortType">
> <wsdl:operation name="SendClaim">
> <wsdl:input message="tns:ClaimIn"/>
> <wsdl:output message="tns:ClaimOut"/>
> </wsdl:operation>
> </wsdl:portType>
> 
> <wsdl:binding name="ClaimBinding" type="tns:ClaimPortType">
> <soapbind:binding style="document"
> transport="http://schemas.xmlsoap.org/soap/http"/>
> <wsdl:operation name="SendClaim">
> <soapbind:operation soapAction="http://example.com/soapaction"/>
> <wsdl:input>
> <mime:multipartRelated>
> <mime:part>
> <soapbind:body parts="body" use="literal"/>
> </mime:part>
> <mime:part>
> <mime:content part="ClaimPhoto" type="image/jpeg"/>
> </mime:part>
> </mime:multipartRelated>
> </wsdl:input>
> <wsdl:output>
> <soapbind:body use="literal" />
> </wsdl:output>
> </wsdl:operation>
> </wsdl:binding>
> </wsdl:definitions>
> 
> Thank you for your efforts.
> 
> 
> Tony Dean
> SAS Institute Inc.
> 919.531.6704
> tony.dean@sas.com
> 
> SAS... The Power to Know
> http://www.sas.com
> 
> 


-- 
Ajith Ranabahu