Microsoft Developer Network > 포럼 홈 > Windows Communication Foundation > Problem creating proxy for java webservice with svcutil
질문하기질문하기
 

답변됨Problem creating proxy for java webservice with svcutil

  • 2007년 3월 12일 월요일 오전 8:50msteinle 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     
    Hello,

    I tried to create a proxy for a java web service using svcutil.exe.
    Svcutil.exe fails with the message
    Error: Cannot import wsdl:portType
    Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.XmlSerializerMessageContractImporter
    Error: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
    XPath to Error Source: //wsdl:definitions[@targetNamespace='http://www.it-informatik.de/de/itinformatik/SOAMetaModel/Services/SecurityManager']/wsdl:portType[@name='AccessControl']

    The wsdl is as follows:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <definitions name="de.itinformatik.SOAMetaModel.Services.SecurityManager.AccessControl" targetNamespace="http://www.it-informatik.de/de/itinformatik/SOAMetaModel/Services/SecurityManager"
        xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:ns2="http://www.it-informatik.de/de/itinformatik/SOAMetaModel/Services/SecurityManager/types"
        xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.it-informatik.de/de/itinformatik/SOAMetaModel/Services/SecurityManager"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <types>
            <schema targetNamespace="http://www.it-informatik.de/de/itinformatik/SOAMetaModel/Services/SecurityManager/types"
                xmlns="http://www.w3.org/2001/XMLSchema" xmlns:soap11-enc="http://schemas.xmlsoap.org/soap/encoding/"
                xmlns:tns="http://www.it-informatik.de/de/itinformatik/SOAMetaModel/Services/SecurityManager/types"
                xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                <complexType name="ServiceException">
                    <sequence>
                        <element name="domainClass" nillable="true" type="string" />
                        <element name="message" nillable="true" type="string" />
                    </sequence>
                </complexType>
                <complexType name="InternalException">
                    <complexContent>
                        <extension base="tns:ServiceException">
                            <sequence />
                        </extension>
                    </complexContent>
                </complexType>
                <complexType name="PersistenceException">
                    <complexContent>
                        <extension base="tns:ServiceException">
                            <sequence />
                        </extension>
                    </complexContent>
                </complexType>
                <complexType name="AuthenticationFailedException">
                    <complexContent>
                        <extension base="tns:ServiceException">
                            <sequence />
                        </extension>
                    </complexContent>
                </complexType>
                <complexType name="TransactionException">
                    <complexContent>
                        <extension base="tns:ServiceException">
                            <sequence />
                        </extension>
                    </complexContent>
                </complexType>
                <complexType name="EnlistmentFailedException">
                    <complexContent>
                        <extension base="tns:TransactionException">
                            <sequence />
                        </extension>
                    </complexContent>
                </complexType>
                <complexType name="StringArray">
                    <sequence>
                        <element maxOccurs="unbounded" minOccurs="0" name="content" nillable="true" type="string" />
                    </sequence>
                </complexType>
                <complexType name="BooleanArray">
                    <sequence>
                        <element maxOccurs="unbounded" minOccurs="0" name="content" type="boolean" />
                    </sequence>
                </complexType>
                <element name="PersistenceException" type="tns:PersistenceException" />
                <element name="TransactionException" type="tns:TransactionException" />
                <element name="InternalException" type="tns:InternalException" />
                <element name="EnlistmentFailedException" type="tns:EnlistmentFailedException" />
            </schema>
        </types>
        <message name="TransactionException">
            <part element="ns2:TransactionException" name="TransactionException" />
        </message>
        <message name="AccessControl_isAuthorizedForUseCases">
            <part name="String_1" type="xsd:string" />
            <part name="StringArray_2" type="ns2:StringArray" />
        </message>
        <message name="PersistenceException">
            <part element="ns2:PersistenceException" name="PersistenceException" />
        </message>
        <message name="AccessControl_isAuthorizedForUseCasesResponse">
            <part name="result" type="ns2:BooleanArray" />
        </message>
        <message name="InternalException">
            <part element="ns2:InternalException" name="InternalException" />
        </message>
        <message name="EnlistmentFailedException">
            <part element="ns2:EnlistmentFailedException" name="EnlistmentFailedException" />
        </message>
        <portType name="AccessControl">
            <operation name="isAuthorizedForUseCases" parameterOrder="String_1 StringArray_2">
                <input message="tns:AccessControl_isAuthorizedForUseCases" />
                <output message="tns:AccessControl_isAuthorizedForUseCasesResponse" />
                <fault message="tns:InternalException" name="InternalException" />
                <fault message="tns:PersistenceException" name="PersistenceException" />
                <fault message="tns:TransactionException" name="TransactionException" />
                <fault message="tns:EnlistmentFailedException" name="EnlistmentFailedException" />
            </operation>
        </portType>
        <binding name="AccessControlBinding" type="tns:AccessControl">
            <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
            <operation name="isAuthorizedForUseCases">
                <soap:operation soapAction="" />
                <input>
                    <soap:body namespace="http://www.it-informatik.de/de/itinformatik/SOAMetaModel/Services/SecurityManager" use="literal" />
                </input>
                <output>
                    <soap:body namespace="http://www.it-informatik.de/de/itinformatik/SOAMetaModel/Services/SecurityManager" use="literal" />
                </output>
                <fault name="InternalException">
                    <soap:fault name="InternalException" use="literal" />
                </fault>
                <fault name="PersistenceException">
                    <soap:fault name="PersistenceException" use="literal" />
                </fault>
                <fault name="TransactionException">
                    <soap:fault name="TransactionException" use="literal" />
                </fault>
                <fault name="EnlistmentFailedException">
                    <soap:fault name="EnlistmentFailedException" use="literal" />
                </fault>
            </operation>
        </binding>
        <service name="De.itinformatik.SOAMetaModel.Services.SecurityManager.AccessControl">
            <port binding="tns:AccessControlBinding" name="AccessControlPort">
                <soap:address location="http://it1srv19:8080/SecurityManager/AccessControl" />
            </port>
        </service>
    </definitions>

    Using .NET2.0/WSE3.0, there was no problem to create the proxy.
    Any suggestions?
    Regards, Martin

답변

  • 2007년 3월 16일 금요일 오후 9:11Hao Xu - MSFT 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     답변됨
    Sorry, my bad. It turned out to be the differences between XmlSerializer and XmlFormatter. If you use XmlSerializer (use SvcUtil option /serializer:XmlSerializer), it should work fine.

모든 응답

  • 2007년 3월 12일 월요일 오후 7:20Quantum00MVP사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     
    Is that error message in German??
  • 2007년 3월 13일 화요일 오후 3:27msteinle 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     

    It is in german, the english translation is "Object reference not set to an instance of an object.". The standard message of a NullReferenceException.

  • 2007년 3월 16일 금요일 오후 5:05Hao Xu - MSFT 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     
    I don't see the soap:binding element in the AccessControl portType. Could that be the cause? Is it possible for you to update the WSDL and see if it fixes the problem?
  • 2007년 3월 16일 금요일 오후 5:24msteinle 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     

    I've never seen a portType with soap:binding element. The soap:binding element is in the binding.

    To be sure, I looked at the wsdl of a .NET WSE web service. It does not have a soap:binding element in its portType, but in the wsdl:binding element, just like my java web service.

    Greetings, Martin

  • 2007년 3월 16일 금요일 오후 9:11Hao Xu - MSFT 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     답변됨
    Sorry, my bad. It turned out to be the differences between XmlSerializer and XmlFormatter. If you use XmlSerializer (use SvcUtil option /serializer:XmlSerializer), it should work fine.
  • 2007년 3월 19일 월요일 오후 1:26msteinle 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     
    Thank you for your reply. I tried this, and svcutil completed without exception.
    But now, the generated proxy code does not compile.
    In the generated interface, the method is annotated with some FaultContract attributes, which refer to classes svcutil did not generate.
    The attributes look the following:
        [System.ServiceModel.FaultContractAttribute(typeof(www.itinformatik.de.de1.itinformatik1.SOAMetaModel.Services.SecurityManager.types.InternalException), Action="", Name="InternalException", Namespace="http://www.it-informatik.de/de/itinformatik/SOAMetaModel/Services/SecurityManager" +
            "/types")]
        [System.ServiceModel.FaultContractAttribute(typeof(www.itinformatik.de.de1.itinformatik1.SOAMetaModel.Services.SecurityManager.types.PersistenceException), Action="", Name="PersistenceException", Namespace="http://www.it-informatik.de/de/itinformatik/SOAMetaModel/Services/SecurityManager" +
            "/types")]
        [System.ServiceModel.FaultContractAttribute(typeof(www.itinformatik.de.de1.itinformatik1.SOAMetaModel.Services.SecurityManager.types.TransactionException), Action="", Name="TransactionException", Namespace="http://www.it-informatik.de/de/itinformatik/SOAMetaModel/Services/SecurityManager" +
            "/types")]
        [System.ServiceModel.FaultContractAttribute(typeof(www.itinformatik.de.de1.itinformatik1.SOAMetaModel.Services.SecurityManager.types.EnlistmentFailedException), Action="", Name="EnlistmentFailedException", Namespace="http://www.it-informatik.de/de/itinformatik/SOAMetaModel/Services/SecurityManager" +
            "/types")]

    I had to remove those attributes to make the proxy work.
    Could you tell me if Microsoft is planning to improve svcutil for better support of Java web services?