Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/371.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java SOAP响应XML唯一标记_Java_Iphone_Web Services_Soap_Wsdl - Fatal编程技术网

Java SOAP响应XML唯一标记

Java SOAP响应XML唯一标记,java,iphone,web-services,soap,wsdl,Java,Iphone,Web Services,Soap,Wsdl,我正在使用SOAP和WSDL创建web服务。在创建WSDL之后,我正在使用eclipse生成“JavaBean框架”。从生成的存根中,我可以从IOS应用程序调用web服务。 在web服务响应中,我将向用户返回复杂的数据类型。问题是,, 我将获得复杂类型的唯一响应标签,如下所示。 我的WSDL是, <?xml version="1.0" encoding="UTF-8" standalone="no"?> <wsdl:definitions xmlns:apachesoap="h

我正在使用SOAP和WSDL创建web服务。在创建WSDL之后,我正在使用eclipse生成“JavaBean框架”。从生成的存根中,我可以从IOS应用程序调用web服务。 在web服务响应中,我将向用户返回复杂的数据类型。问题是,, 我将获得复杂类型的唯一响应标签,如下所示。

我的WSDL是,

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wsdl:definitions xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://service.cmp.app.com" xmlns:intf="http://service.cmp.app.com" xmlns:tns1="http://request.cmp.app.com" xmlns:tns2="http://response.cmp.app.com" xmlns:tns3="http://bean.cmp.app.com" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://service.cmp.app.com">
    <!--WSDL created by Apache Axis version: 1.4 Built on Apr 22, 2006 (06:55:48 
        PDT) -->
    <wsdl:types>
        <schema xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://service.cmp.app.com">
            <import namespace="http://response.cmp.app.com"/>
            <import namespace="http://request.cmp.app.com"/>
            <import namespace="http://bean.cmp.app.com"/>
            <element name="ViewAppTrack">
                <complexType>
                    <sequence>
                        <element name="ViewAppTrackRequest" type="tns1:ViewAppTrackRequest"/>
                    </sequence>
                </complexType>
            </element>
            <element name="ViewAppTrackResponse">
                <complexType>
                    <sequence>
                        <element name="ViewAppTrackResponseReturn" type="tns2:ViewAppTrackResponse"/>
                    </sequence>
                </complexType>
            </element>
            <complexType name="ArrayOf_tns3_MonthListBO">
                <sequence>
                    <element maxOccurs="unbounded" minOccurs="0" name="monthListItem" type="tns3:MonthListBO"/>
                </sequence>
            </complexType>
            <complexType name="ArrayOf_tns3_TaskListBO">
                <sequence>
                    <element maxOccurs="unbounded" minOccurs="0" name="taskListItem" type="tns3:TaskListBO"/>
                </sequence>
            </complexType>
        </schema>
        <schema xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://request.cmp.app.com">
            <import namespace="http://response.cmp.app.com"/>
            <import namespace="http://service.cmp.app.com"/>
            <import namespace="http://bean.cmp.app.com"/>
            <complexType name="ViewAppTrackRequest">
                <sequence>
                    <element name="userId" nillable="true" type="xsd:string"/>
                </sequence>
            </complexType>
        </schema>
        <schema xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://bean.cmp.app.com">
            <import namespace="http://response.cmp.app.com"/>
            <import namespace="http://service.cmp.app.com"/>
            <import namespace="http://request.cmp.app.com"/>
            <complexType name="MonthListBO">
                <sequence>
                    <element name="date" nillable="true" type="xsd:string"/>
                    <element name="lockStatus" nillable="true" type="xsd:string"/>
                    <element name="dailyTime" nillable="true" type="xsd:string"/>
                    <element name="taskListNew" nillable="true" type="impl:ArrayOf_tns3_TaskListBO"/>
                </sequence>
            </complexType>
            <complexType name="TaskListBO">
                <sequence>
                    <element name="trackId" type="xsd:int"/>
                    <element name="taskId" type="xsd:int"/>
                    <element name="trackDate" nillable="true" type="xsd:string"/>
                </sequence>
            </complexType>
        </schema>
        <schema xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://response.cmp.app.com">
            <import namespace="http://service.cmp.app.com"/>
            <import namespace="http://request.cmp.app.com"/>
            <import namespace="http://bean.cmp.app.com"/>
            <complexType name="ViewAppTrackResponse">
                <sequence>
                    <element name="monthBO" nillable="true" type="impl:ArrayOf_tns3_MonthListBO"/>
                    <element name="userId" nillable="true" type="xsd:string"/>
                    <element name="projectId" nillable="true" type="xsd:string"/>
                    <element name="customerId" nillable="true" type="xsd:string"/>
                </sequence>
            </complexType>
        </schema>
    </wsdl:types>

    <wsdl:message name="ViewAppTrackRequest">

        <wsdl:part element="impl:ViewAppTrack" name="parameters">

        </wsdl:part>

    </wsdl:message>

    <wsdl:message name="ViewAppTrackResponse">

        <wsdl:part element="impl:ViewAppTrackResponse" name="parameters">

        </wsdl:part>

    </wsdl:message>

    <wsdl:portType name="AppWeb">

        <wsdl:operation name="ViewAppTrack">

            <wsdl:input message="impl:ViewAppTrackRequest" name="ViewAppTrackRequest">

            </wsdl:input>

            <wsdl:output message="impl:ViewAppTrackResponse" name="ViewAppTrackResponse">

            </wsdl:output>

        </wsdl:operation>

    </wsdl:portType>

    <wsdl:binding name="AppWebSoapBinding" type="impl:AppWeb">

        <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>

        <wsdl:operation name="ViewAppTrack">

            <wsdlsoap:operation soapAction=""/>

            <wsdl:input name="ViewAppTrackRequest">

                <wsdlsoap:body use="literal"/>

            </wsdl:input>

            <wsdl:output name="ViewAppTrackResponse">

                <wsdlsoap:body use="literal"/>

            </wsdl:output>

        </wsdl:operation>

    </wsdl:binding>

    <wsdl:service name="AppWebService">

        <wsdl:port binding="impl:AppWebSoapBinding" name="AppWeb">

            <wsdlsoap:address location="http://localhost:8080/test/services/AppWeb"/>

        </wsdl:port>

    </wsdl:service>

</wsdl:definitions>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://service.cmp.app.com" xmlns:req="http://request.cpm.app.com">
   <soapenv:Header/>
   <soapenv:Body>
      <ser:ViewAppTrack>
         <ser:ViewAppTrackRequest>
            <req:userId>5</req:userId>
         </ser:ViewAppTrackRequest>
      </ser:ViewAppTrack>
   </soapenv:Body>
</soapenv:Envelope>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
      <ViewAppTrackResponse xmlns="http://service.cmp.app.com">
         <ViewAppTrackResponseReturn>
            <ns1:monthBO xmlns:ns1="http://response.cmp.app.com">
               <monthListItem>
                  <ns2:date xmlns:ns2="http://bean.cmp.app.com">1-2-2014, Saturday (nonworking day)</ns2:date>
                  <ns3:lockStatus xmlns:ns3="http://bean.cmp.app.com">N</ns3:lockStatus>
                  <ns4:dailyTime xsi:nil="true" xmlns:ns4="http://bean.cmp.app.com"/>
                  <ns5:taskListNew xsi:nil="true" xmlns:ns5="http://bean.cmp.app.com"/>
               </monthListItem>
               <monthListItem>
                  <ns6:date xmlns:ns6="http://bean.cmp.app.com">2-2-2014, Sunday (nonworking day)</ns6:date>
                  <ns7:lockStatus xmlns:ns7="http://bean.cmp.app.com">N</ns7:lockStatus>
                  <ns8:dailyTime xmlns:ns8="http://bean.cmp.app.com">04:00</ns8:dailyTime>
                  <ns9:taskListNew xmlns:ns9="http://bean.cmp.app.com">
                     <taskListItem>
                        <ns9:trackId>1070</ns9:trackId>
                        <ns9:taskId>14</ns9:taskId>
                     </taskListItem>
                     <taskListItem>
                        <ns9:trackId>1094</ns9:trackId>
                        <ns9:taskId>44</ns9:taskId>
                     </taskListItem>
                  </ns9:taskListNew>
               </monthListItem>
               <monthListItem>
                  <ns10:date xmlns:ns10="http://bean.cmp.app.com">3-2-2014, Monday</ns10:date>
                  <ns11:lockStatus xmlns:ns11="http://bean.cmp.app.com">N</ns11:lockStatus>
                  <ns12:dailyTime xmlns:ns12="http://bean.cmp.app.com">08:00</ns12:dailyTime>
                  <ns13:taskListNew xmlns:ns13="http://bean.cmp.app.com">
                     <taskListItem>
                        <ns13:trackId>1071</ns13:trackId>
                        <ns13:taskId>14</ns13:taskId>
                     </taskListItem>
                     <taskListItem>
                        <ns13:trackId>1073</ns13:trackId>
                        <ns13:taskId>44</ns13:taskId>
                       </taskListItem>
                  </ns13:taskListNew>
               </monthListItem>
            </ns1:monthBO>
            <ns14:userId xsi:nil="true" xmlns:ns114="http://response.cmp.app.com"/>5</ns14:userId>
         </ViewAppTrackResponseReturn>
      </ViewAppTrackResponse>
   </soapenv:Body>
</soapenv:Envelope>
我是否可以更改以下响应。这样我就可以从IOS解析这个响应。


或者可以在IOS中解析复杂类型响应数据吗?

能否显示后端代码?我对所需的输出有点困惑。您希望为每个
monthListItem
及其包含的
taskListItem
s使用不同的命名空间,尽管
monthListItem
可能在
http://response.cmp.app.com
taskListItem
中的
http://bean.cmp.app.com
。如果ns9、ns10或ns11应为
monthListItem
应为的月份,最好定义一个属性并设置月份there@RomanVottner:谢谢你的回复。不,我不想使用不同的名称空间。我已经编辑了我的问题。请检查主题“我可以像下面这样更改响应吗?以便我可以从IOS解析此响应。”我可以得到这样的响应吗?除非您更改模式定义本身,从而更改响应返回的语法,或者使用XSLT将收到的响应转换为所需的格式,否则我怀疑这是否很容易实现。@RomanVottner:您能告诉我在上面的wsdl中应该在哪里更改吗?
(i.e,) monthBO -> 
        monthListItem -> taskListItem, taskListItem, etc..., 
        monthListItem -> taskListItem, taskListItem, etc...,
        monthListItem -> taskListItem, taskListItem, etc...,
        etc...
(i.e,) monthBO -> 
        monthListItem1 -> taskListItem1, taskListItem2 
        monthListItem2 -> taskListItem3, taskListItem4
        monthListItem3 -> taskListItem5, taskListItem6
        etc...