Olá pessoal,
implementei o meu webservice com o framework Axis v1. Criei um método fake no meu .jws para teste de comunicacao com o cliente (App IPhone):
public Object teste(String login, String senha){
String xml = "";
if(login.equals("dct") && senha.equals("123") ){
xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><resposta msg=\"Sucesso\" />";
}else{
xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><resposta msg=\"Erro meu vei\" />";
}
return xml;
}
Porém ao acessar o WS via browser pela url:http://localhost:8080/ri_head/IPhone.jws?method=teste&login=asdfa&senha=123 o resultado é o seguinte xml:
<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>
<testeResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<testeReturn xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"><?xml version="1.0" encoding="UTF-8"?><resposta msg="Erro meu vei" /></testeReturn>
</testeResponse>
</soapenv:Body>
</soapenv:Envelope>
Isto é, automaticamente os caracteres < e > foram substituídos pelos seus valores correspondentes (< e >). Verifiquei no IPhone e ocorre a mesma coisa. Ao acessar o wsdl gerado pelo Axis via url: http://localhost:8080/ri_head/IPhone.jws?wsdl tenho o seguinte xml:
<wsdl:definitions targetNamespace="http://localhost:8080/ri_head/IPhone.jws" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://localhost:8080/ri_head/IPhone.jws" xmlns:intf="http://localhost:8080/ri_head/IPhone.jws" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 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:message name="testeResponse">
<wsdl:part name="testeReturn" type="xsd:anyType"/>
</wsdl:message>
<wsdl:message name="loginResponse">
<wsdl:part name="loginReturn" type="xsd:string"/>
</wsdl:message>
<wsdl:message name="testeRequest">
<wsdl:part name="login" type="xsd:string"/>
<wsdl:part name="senha" type="xsd:string"/>
</wsdl:message>
<wsdl:message name="loginRequest">
</wsdl:message>
<wsdl:portType name="IPhone">
<wsdl:operation name="login">
<wsdl:input message="impl:loginRequest" name="loginRequest"/>
<wsdl:output message="impl:loginResponse" name="loginResponse"/>
</wsdl:operation>
<wsdl:operation name="teste" parameterOrder="login senha">
<wsdl:input message="impl:testeRequest" name="testeRequest"/>
<wsdl:output message="impl:testeResponse" name="testeResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="IPhoneSoapBinding" type="impl:IPhone">
<wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="login">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="loginRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://DefaultNamespace" use="encoded"/>
</wsdl:input>
<wsdl:output name="loginResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost:8080/ri_head/IPhone.jws" use="encoded"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="teste">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="testeRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://DefaultNamespace" use="encoded"/>
</wsdl:input>
<wsdl:output name="testeResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost:8080/ri_head/IPhone.jws" use="encoded"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="IPhoneService">
<wsdl:port binding="impl:IPhoneSoapBinding" name="IPhone">
<wsdlsoap:address location="http://localhost:8080/ri_head/IPhone.jws"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Alguém sabe me dizer como faço para que esta substituição de caracteres não ocorra?
desde já agradeço a atenção de todos,
vlw