How to fix wsdl file errors? - java

Dears
I trying to make and create web service, firstly i created the server side and wsdl file, but i get some errors in this wsdl file and i tried many time to solve it, i guess i should check the xmlns or xsd.
actually i'am new in webwervices and don't now exactly how to investigate them, please advise me and let me know the error in my code.
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://DefaultNamespace"
xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:impl="http://DefaultNamespace"
xmlns:intf="http://DefaultNamespace"
xmlns:tns1="http://swing.javax"
xmlns:tns2="http://awt.java"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!--WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)-->
<wsdl:types>
<schema elementFormDefault="qualified"
targetNamespace="http://DefaultNamespace"
xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://awt.java"/>
<import namespace="http://swing.javax"/>
The errors is
Description Resource Path Location Type
src-resolve: Cannot resolve the name 'tns1:JPasswordField' to a(n) 'type definition' component. ImbCal.wsdl /SSPtest/WebContent/wsdl line 196 WSDL Problem
Description Resource Path Location Type
src-resolve: Cannot resolve the name 'tns2:List' to a(n) 'type definition' component. ImbCal.wsdl /SSPtest/WebContent/wsdl line 171 WSDL Problem
Description Resource Path Location Type
schema_reference.4: Failed to read schema document 'null', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not . ImbCal.wsdl /SSPtest/WebContent/wsdl line 7 WSDL Problem
Description Resource Path Location Type
schema_reference.4: Failed to read schema document 'null', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not . ImbCal.wsdl /SSPtest/WebContent/wsdl line 8 WSDL Problem
here one of elements
<element name="dbSelect">
<complexType>
<sequence>
<element name="sql" type="xsd:string"/>
<element name="level" type="xsd:string"/>
<element name="mat_sel2" type="tns2:List"/>
<element name="mymaterial" type="tns2:List"/>
</sequence>
</complexType>
</element>

This is the full code, i just edit the wrong from the code and regenerate the wsdll.
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://DefaultNamespace"
xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:impl="http://DefaultNamespace"
xmlns:intf="http://DefaultNamespace"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!--WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)-->
<wsdl:types>
<schema elementFormDefault="qualified"
targetNamespace="http://DefaultNamespace" xmlns="http://www.w3.org
/2001/XMLSchema">
<element name="main">
<complexType>
<sequence>
<element maxOccurs="unbounded" name="arg" type="xsd:string"/>
</sequence>
</complexType>
</element>
<element name="mainResponse">
<complexType>
<sequence>
<element maxOccurs="unbounded" name="mainReturn" type="xsd:string"/>
</sequence>
</complexType>
</element>
<element name="finalmaterial">
<complexType>
<sequence>
<element name="Couresn" type="xsd:string"/>
<element name="IDL" type="xsd:string"/>
<element name="Myco2" type="xsd:string"/>
<element name="userlevel" type="xsd:int"/>
<element name="LevelL" type="xsd:string"/>
</sequence>
</complexType>
</element>
<element name="finalmaterialResponse">
<complexType>
<sequence>
<element maxOccurs="unbounded" name="finalmaterialReturn"
type="xsd:string"/>
</sequence>
</complexType>
</element>
</schema>
</wsdl:types>
<wsdl:message name="finalmaterialRequest">
<wsdl:part element="impl:finalmaterial" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="finalmaterialResponse">
<wsdl:part element="impl:finalmaterialResponse" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="mainRequest">
<wsdl:part element="impl:main" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="mainResponse">
<wsdl:part element="impl:mainResponse" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="ImbCal">
<wsdl:operation name="main">
<wsdl:input message="impl:mainRequest" name="mainRequest">
</wsdl:input>
<wsdl:output message="impl:mainResponse" name="mainResponse">
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="finalmaterial">
<wsdl:input message="impl:finalmaterialRequest"
name="finalmaterialRequest">
</wsdl:input>
<wsdl:output message="impl:finalmaterialResponse"
name="finalmaterialResponse">
</wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ImbCalSoapBinding" type="impl:ImbCal">
<wsdlsoap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="main">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="mainRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="mainResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="finalmaterial">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="finalmaterialRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="finalmaterialResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="ImbCalService">
<wsdl:port binding="impl:ImbCalSoapBinding" name="ImbCal">
<wsdlsoap:address location="http://localhost:8080/SSPwebservice
/services/ImbCal"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

Related

Cannot resolve the name ... to a(n) 'type definition' component

I want to import code from a WSDL file with wsimport, but i receiving this error below.
[WARNING] src-resolve: Cannot resolve the name 'impl:ArrayOf_tns1_IndicadorVO' to a(n) 'type definition' component.
Here's the WSDL file...
<?xml version="1.0" encoding="UTF-8"?> <wsdl:definitions targetNamespace="http://ws.cnmpind.cnmp.gov.br" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://ws.cnmpind.cnmp.gov.br" xmlns:intf="http://ws.cnmpind.cnmp.gov.br" xmlns:tns1="http://vo.ws.cnmpind.cnmp.gov.br" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!--WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)-->
<wsdl:types>
<schema elementFormDefault="qualified" targetNamespace="http://ws.cnmpind.cnmp.gov.br" xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://vo.ws.cnmpind.cnmp.gov.br"/>
<element name="getQuestionariosDisponiveis">
<complexType>
<sequence>
<element name="email" type="xsd:string"/>
<element name="senha" type="xsd:string"/>
<element name="dataInicio" type="xsd:string"/>
<element name="dataFinal" type="xsd:string"/>
<element name="areaAtuacao" type="xsd:string"/>
</sequence>
</complexType>
</element>
<element name="getQuestionariosDisponiveisResponse">
<complexType>
<sequence>
<element maxOccurs="unbounded" name="getQuestionariosDisponiveisReturn" type="tns1:QuestionarioVO"/>
</sequence>
</complexType>
</element>
<complexType name="ArrayOf_tns1_IndicadorVO">
<sequence>
<element maxOccurs="unbounded" minOccurs="0" name="item" type="tns1:IndicadorVO"/>
</sequence>
</complexType>
<element name="salvaRespostasQuestionarios">
<complexType>
<sequence>
<element name="email" type="xsd:string"/>
<element name="senha" type="xsd:string"/>
<element name="dataInicio" type="xsd:string"/>
<element name="dataFinal" type="xsd:string"/>
<element name="areaAtuacao" type="xsd:string"/>
<element maxOccurs="unbounded" name="questionarios" type="tns1:QuestionarioVO"/>
</sequence>
</complexType>
</element>
<element name="salvaRespostasQuestionariosResponse">
<complexType/>
</element>
</schema>
<schema elementFormDefault="qualified" targetNamespace="http://vo.ws.cnmpind.cnmp.gov.br" xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://ws.cnmpind.cnmp.gov.br"/>
<complexType name="IndicadorVO">
<sequence>
<element name="descricaoDescritor" nillable="true" type="xsd:string"/>
<element name="id" type="xsd:long"/>
<element name="idDescritor" type="xsd:int"/>
<element name="idIndicadorPai" type="xsd:long"/>
<element name="idQuestionario" type="xsd:long"/>
<element name="nomeDescritor" nillable="true" type="xsd:string"/>
<element name="ordem" type="xsd:int"/>
<element name="tamanhoDescritor" nillable="true" type="xsd:decimal"/>
<element name="tipoDescritor" nillable="true" type="xsd:string"/>
<element name="valor" nillable="true" type="xsd:decimal"/>
</sequence>
</complexType>
<complexType name="QuestionarioVO">
<sequence>
<element name="aberto" type="xsd:boolean"/>
<element name="dataAtualizacao" nillable="true" type="xsd:string"/>
<element name="dataInicio" nillable="true" type="xsd:string"/>
<element name="dataTermino" nillable="true" type="xsd:string"/>
<element name="descricaoArea" nillable="true" type="xsd:string"/>
<element name="id" type="xsd:long"/>
<element name="idArea" type="xsd:int"/>
<element name="idUnidade" type="xsd:int"/>
<element name="indicadores" nillable="true" type="impl:ArrayOf_tns1_IndicadorVO"/>
<element name="nomeArea" nillable="true" type="xsd:string"/>
<element name="nomeUnidade" nillable="true" type="xsd:string"/>
<element name="nomeUsuarioAtualizacao" nillable="true" type="xsd:string"/>
<element name="siglaUnidade" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
</schema>
</wsdl:types>
<wsdl:message name="salvaRespostasQuestionariosResponse">
<wsdl:part element="impl:salvaRespostasQuestionariosResponse" name="parameters"/>
</wsdl:message>
<wsdl:message name="getQuestionariosDisponiveisResponse">
<wsdl:part element="impl:getQuestionariosDisponiveisResponse" name="parameters"/>
</wsdl:message>
<wsdl:message name="getQuestionariosDisponiveisRequest">
<wsdl:part element="impl:getQuestionariosDisponiveis" name="parameters"/>
</wsdl:message>
<wsdl:message name="salvaRespostasQuestionariosRequest">
<wsdl:part element="impl:salvaRespostasQuestionarios" name="parameters"/>
</wsdl:message>
<wsdl:portType name="QuestionarioWS">
<wsdl:operation name="getQuestionariosDisponiveis">
<wsdl:input message="impl:getQuestionariosDisponiveisRequest" name="getQuestionariosDisponiveisRequest"/>
<wsdl:output message="impl:getQuestionariosDisponiveisResponse" name="getQuestionariosDisponiveisResponse"/>
</wsdl:operation>
<wsdl:operation name="salvaRespostasQuestionarios">
<wsdl:input message="impl:salvaRespostasQuestionariosRequest" name="salvaRespostasQuestionariosRequest"/>
<wsdl:output message="impl:salvaRespostasQuestionariosResponse" name="salvaRespostasQuestionariosResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="QuestionarioWSSoapBinding" type="impl:QuestionarioWS">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="getQuestionariosDisponiveis">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="getQuestionariosDisponiveisRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="getQuestionariosDisponiveisResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="salvaRespostasQuestionarios">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="salvaRespostasQuestionariosRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="salvaRespostasQuestionariosResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="QuestionarioWSService">
<wsdl:port binding="impl:QuestionarioWSSoapBinding" name="QuestionarioWS">
<wsdlsoap:address location="http://aplicativos.cnmp.gov.br/cnmpind/services/QuestionarioWS"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Someone can give me some light? Thanks!
EDIT 1:
This is just a warning. The true error is
package-info.java:1: error: error while writing package-info: could
not create parent directories
#javax.xml.bind.annotation.XmlSchema(namespace =
"http://ws.cnmpind.cnmp.gov.br", elementFormDefault =
javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
So, the code was generated, but the error happens when compiling.
Its seems to be a WSIMPORT bug, i don't know.
To solve the problem, I used the param "-Xnocompile" to force WSIMPORT only generate the code whithout compiling.
After that, i compiled the code by command line with javac and put the classes into a .jar
I added the .jar to the project and everything are running fine.

Can't get an output while calling java web service using php

I have create a web service using java. I used the below code to call the web service using php.
$client = new SoapClient("http://localhost:8080/imageCom/wsdl/CompareImage.wsdl");
$stock = "http://localhost/pic/blueTshirts/b10.jpg";
$parameters= array("url"=>$stock);
$values = $client->checkSimilarity($parameters);
var_dump($values);
When I run the code I get the following output. But it doesn't display the result
output: object(stdClass)#2 (0) { }
Here is my WSDL
<wsdl:definitions xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://simalarity.imageCom" xmlns:intf="http://simalarity.imageCom" 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://simalarity.imageCom">
<!--
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://simalarity.imageCom">
<element name="checkSimilarity">
<complexType>
<sequence>
<element name="url" type="xsd:string"/>
</sequence>
</complexType>
</element>
<element name="checkSimilarityResponse">
<complexType/>
</element>
</schema>
</wsdl:types>
<wsdl:message name="checkSimilarityRequest">
<wsdl:part element="impl:checkSimilarity" name="parameters"></wsdl:part>
</wsdl:message>
<wsdl:message name="checkSimilarityResponse">
<wsdl:part element="impl:checkSimilarityResponse" name="parameters"></wsdl:part>
</wsdl:message>
<wsdl:portType name="CompareImage">
<wsdl:operation name="checkSimilarity">
<wsdl:input message="impl:checkSimilarityRequest" name="checkSimilarityRequest"></wsdl:input>
<wsdl:output message="impl:checkSimilarityResponse" name="checkSimilarityResponse"></wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="CompareImageSoapBinding" type="impl:CompareImage">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="checkSimilarity">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="checkSimilarityRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="checkSimilarityResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="CompareImageService">
<wsdl:port binding="impl:CompareImageSoapBinding" name="CompareImage">
<wsdlsoap:address location="http://localhost:8080/imageCom/services/CompareImage"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
What I am doing wrong? Please help me.
The thing is you are getting standard class object array in return.
You have to extract the values accordingly
print_r($array) will print your array recursively.
You may also loop over an array of objects like below,
foreach ($array as $key => $object) {
echo $object->object_property;
}
Think of an array as a collection of things. It's a bag where you can store your stuff and give them a unique id (key) and access them.

SOAP - response XML unique tag

I am creating the web-service with the use of SOAP & WSDL. After creating WSDL I am generating the "Java bean skeleton" using eclipse. From the generated stubs I can able to call the web-service from IOS app.
In the web-service response I am returning the complex data type to the user. The problem is,
I am getting the unique response tag for the complex type as given below.
My WSDL is,
<?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>
And my request XML is,
<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>
The following response I am getting,
<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>
The problem:
I am getting the above XML response as same tag like monthListItem, taskListItem.
(i.e,) monthBO ->
monthListItem -> taskListItem, taskListItem, etc...,
monthListItem -> taskListItem, taskListItem, etc...,
monthListItem -> taskListItem, taskListItem, etc...,
etc...
Can I change the response like below. So that I can parse this response from IOS.
(i.e,) monthBO ->
monthListItem1 -> taskListItem1, taskListItem2
monthListItem2 -> taskListItem3, taskListItem4
monthListItem3 -> taskListItem5, taskListItem6
etc...
Or is it possible to parse the complex type response data in IOS?

accessing a java webservice from the webservice client

I am trying to access a java webservice by sending a soap request to the service
the strange part is that until recently it worked fine, and now it gives me an internal server error
what am i doing wrong ??
this is my soap message:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:q0="http://webservice.lenabru.com" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Body> <q0:register><q0:regFirstName></q0:regFirstName><q0:regLastName></q0:regLastName><q0:regLoginName></q0:regLoginName><q0:regPassword></q0:regPassword><q0:regAddress></q0:regAddress><q0:regEmail></q0:regEmail><q0:regPhone></q0:regPhone></q0:register></soapenv:Body></soapenv:Envelope>
and this is the response i get from the server
"<?xml version="1.0" encoding="UTF-8"?><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>
<soapenv:Fault>
<faultcode>soapenv:Server.userException</faultcode>
<faultstring>java.lang.reflect.InvocationTargetException</faultstring>
<detail>
<ns1:hostname xmlns:ns1="http://xml.apache.org/axis/">Lena</ns1:hostname>
</detail>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>"
this is the contents of the webmethod i am trying to reach:
#WebMethod
public boolean register(String regFirstName, String regLastName, String regLoginName, String regPassword, String regAddress, String regPhone, String regEmail) {
return false;
}
this is my wsdl:
<wsdl:definitions xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://webservice.lenabru.com" xmlns:intf="http://webservice.lenabru.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://webservice.lenabru.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://webservice.lenabru.com">
<element name="register">
<complexType>
<sequence>
<element name="regFirstName" type="xsd:string"/>
<element name="regLastName" type="xsd:string"/>
<element name="regLoginName" type="xsd:string"/>
<element name="regPassword" type="xsd:string"/>
<element name="regAddress" type="xsd:string"/>
<element name="regPhone" type="xsd:string"/>
<element name="regEmail" type="xsd:string"/>
</sequence>
</complexType>
</element>
<element name="registerResponse">
<complexType>
<sequence>
<element name="registerReturn" type="xsd:boolean"/>
</sequence>
</complexType>
</element>
<element name="isUserExists">
<complexType>
<sequence>
<element name="userName" type="xsd:string"/>
</sequence>
</complexType>
</element>
<element name="isUserExistsResponse">
<complexType>
<sequence>
<element name="isUserExistsReturn" type="xsd:boolean"/>
</sequence>
</complexType>
</element>
</schema>
</wsdl:types>
<wsdl:message name="isUserExistsResponse">
<wsdl:part element="impl:isUserExistsResponse" name="parameters"></wsdl:part>
</wsdl:message>
<wsdl:message name="registerRequest">
<wsdl:part element="impl:register" name="parameters"></wsdl:part>
</wsdl:message>
<wsdl:message name="isUserExistsRequest">
<wsdl:part element="impl:isUserExists" name="parameters"></wsdl:part>
</wsdl:message>
<wsdl:message name="registerResponse">
<wsdl:part element="impl:registerResponse" name="parameters"></wsdl:part>
</wsdl:message>
<wsdl:portType name="ElectronicArenaWebService">
<wsdl:operation name="register">
<wsdl:input message="impl:registerRequest" name="registerRequest"></wsdl:input>
<wsdl:output message="impl:registerResponse" name="registerResponse"></wsdl:output>
</wsdl:operation>
<wsdl:operation name="isUserExists">
<wsdl:input message="impl:isUserExistsRequest" name="isUserExistsRequest"></wsdl:input>
<wsdl:output message="impl:isUserExistsResponse" name="isUserExistsResponse"></wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ElectronicArenaWebServiceSoapBinding" type="impl:ElectronicArenaWebService">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="register">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="registerRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="registerResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="isUserExists">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="isUserExistsRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="isUserExistsResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="ElectronicArenaWebServiceService">
<wsdl:port binding="impl:ElectronicArenaWebServiceSoapBinding" name="ElectronicArenaWebService">
<wsdlsoap:address location="http://localhost:8080/ElectronicArenaLena/services/ElectronicArenaWebService"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
First a note: if you're using Tomcat 7 (why not use Axis 2 ?)
Setup for Log4j (at the time axis 1 was still there there was log4j, now there is a better alternatives from the same author of Log4j it's called logback - however there is a new Log4j 2 now but I haven't tested it for this setup only the one that comes with axis downloaded here
http://archive.apache.org/dist/ws/axis/1_4/)
create a log4j.properties file and put it in your WEB-INF/classes folder
(I created a sample content so that you can get going, might need to look at log4j's documentation to modify the logs as you need - the below creates multiple log files(max 5) whenever one's size reaches 100k it creates another, you might need to change the size or number as needed or just use one)
log4j.rootLogger=DEBUG, R
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.MaxFileSize=100KB
log4j.appender.R.File=axis.log
log4j.appender.R.MaxBackupIndex=5
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} – %m%n
# below line might not be needed, but I just had it there
log4j.R.org.apache.axis=DEBUG
now open axis.jar and remove whatever properties file you have directly in the folder structure (next to MANIFEST and org folders - I had simplelog.properties so I deleted it)
restart apache tomcat and check the apache logs to make sure log4j isn't throwing any warnings or errors
If everything works fine, you should be able to see axis.log in apache tomcat's bin directory
Note:
you might notice a lot of useless debug logs, however when an exception occurs or some issue happens it might be handy to have this level of details in your logs, plus you can disable it anytime you need, just replace rootLogger DEBUG into INFO or comment log4j.properties all together
References:
http://osdir.com/ml/text.xml.axis.user/2002-08/msg00436.html
http://axis.apache.org/axis/java/developers-guide.html#LoggingTracing

Calling Axis Web Service with Complex Data Type

I have the following wsdl:
<wsdl:definitions targetNamespace="http://localhost:8080/webservice/Retriever.jws">
<wsdl:types>
<schema targetNamespace="http://localhost:8080/webservice/Retriever.jws">
<import namespace="http://DefaultNamespace"/>
<import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<complexType name="ArrayOf_xsd_string">
<complexContent>
<restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:string[]"/>
</restriction>
</complexContent>
</complexType>
<complexType name="ArrayOf_xsd_int">
<complexContent>
<restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:int[]"/>
</restriction>
</complexContent>
</complexType>
</schema>
<schema targetNamespace="http://DefaultNamespace">
<import namespace="http://localhost:8080/webservice/Retriever.jws"/>
<import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<complexType name="Result">
<sequence>
<element name="time" type="xsd:int"/>
<element name="title" nillable="true" type="impl:ArrayOf_xsd_string"/>
<element name="url" nillable="true" type="impl:ArrayOf_xsd_string"/>
<element name="snippet" nillable="true" type="impl:ArrayOf_xsd_string"/>
<element name="position" nillable="true" type="impl:ArrayOf_xsd_int"/>
</sequence>
</complexType>
</schema>
</wsdl:types>
<wsdl:message name="retrieveResponse">
<wsdl:part name="retrieveReturn" type="tns1:Result"/>
</wsdl:message>
<wsdl:message name="retrieveRequest">
<wsdl:part name="query" type="xsd:string"/>
<wsdl:part name="n" type="xsd:int"/>
<wsdl:part name="start" type="xsd:int"/>
</wsdl:message>
<wsdl:portType name="Retriever">
<wsdl:operation name="retrieve" parameterOrder="query n start">
<wsdl:input message="impl:retrieveRequest" name="retrieveRequest"/>
<wsdl:output message="impl:retrieveResponse" name="retrieveResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="RetrieverSoapBinding" type="impl:Retriever">
<wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="retrieve">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="retrieveRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://DefaultNamespace" use="encoded"/>
</wsdl:input>
<wsdl:output name="retrieveResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost:8080/webservice/Retriever.jws" use="encoded"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="RetrieverService">
<wsdl:port binding="impl:RetrieverSoapBinding" name="Retriever">
<wsdlsoap:address location="http://localhost:8080/webservice/Retriever.jws"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
How may I call it!?

Categories