2015-02-06 4 views
0

응답을 받으려면 웹 서비스를 호출하려고합니다. 나는 기반 SOAP 웹 서비스를 사용하고 있습니다.하지만 코드를 실행할 때 sasxexception을 제공합니다. org.xml.sax.SAXException : 잘못된 봉투 태그 : html

import java.io.BufferedWriter; 
import java.io.File; 
import java.io.FileWriter; 
import java.io.IOException; 

import org.apache.axis.client.Call; 
import org.apache.axis.client.Service; 
import org.apache.axis.encoding.XMLType; 

import javax.xml.namespace.QName; 
import javax.xml.rpc.ParameterMode; 

    public class ClientTest { 

     public static void main(String [] args) 
     { 
      String request = "<Request onErrorAbort=\"yes\">\n"+ 
      "<Service name=\""+service+"\" operation=\""+operation+"\" id=\"11500\">\n"+ 
       "<Parameter name=\"ApplicationExterieureIdentifiant\">"+applicationExterieureIdentifiant+"</Parameter>\n"+ 
       "<Parameter name=\"ApplicationExterieureLibelle\">"+applicationExterieureLibelle+"</Parameter>\n"+ 
       "<Parameter name=\"ActionTypeLibelle\">"+actionTypeLibelle+"</Parameter>\n"+ 
       "<Parameter name=\"ActionIdentifiant\">"+actionIdentifiant+"</Parameter>\n"+ 
       "<Parameter name=\"ActionLibelle\">"+actionLibelle+"</Parameter>\n"+ 
       "<Parameter name=\"PatientIdentifiant\">"+patientIdentifiant+"</Parameter>\n"+ 
       "<Parameter name=\"PatientIPP\">"+patientIPP+"</Parameter>\n"+ 
       "<Parameter name=\"VenueIdentifiant\">"+venueIdentifiant+"</Parameter>\n"+ 
       "<Parameter name=\"VenueNumero\">"+venueNumero+"</Parameter>\n"+ 
       "<Parameter name=\"InterventionIdentifiantExterieur\">"+interventionIdentifiantExterieur+"</Parameter>\n"+ 
       "<Parameter name=\"PrescripteurIdentifiant\">"+prescripteurIdentifiant+"</Parameter>\n"+ 
       "<Parameter name=\"PrescripteurCompteUtilisateur\">"+prescripteurCompteUtilisateur+"</Parameter>\n"+ 
       "<Parameter name=\"PrescripteurNomPrenom\">"+prescripteurNomPrenom+"</Parameter>\n"+ 
       "<Parameter name=\"CreateurIdentifiant\">"+createurIdentifiant+"</Parameter>\n"+ 
       "<Parameter name=\"CreateurCompteUtilisateur\">"+createurCompteUtilisateur+"</Parameter>\n"+ 
       "<Parameter name=\"InterventionMetiers\">"+interventionMetiers+"</Parameter>\n"+ 
       "<Parameter name=\"InterventionPlanificationDate\">"+interventionPlanificationDate+"</Parameter>\n"+ 
       "<Parameter name=\"InterventionPlanificationDansJournee\">"+interventionPlanificationDansJournee+"</Parameter>\n"+ 
       "<Parameter name=\"InterventionPlanificationAuBesoin\">"+interventionPlanificationAuBesoin+"</Parameter>\n"+ 
       "<Parameter name=\"InterventionPlanificationAuBesoinCondition\">"+interventionPlanificationAuBesoinCondition+"</Parameter>\n"+ 
       "<Parameter name=\"InterventionPlanificationDuree\">"+interventionPlanificationDuree+"</Parameter>\n"+ 
       "<Parameter name=\"InterventionPlanificationCommentaire\">"+interventionPlanificationCommentaire+"</Parameter>\n"+ 
       "<Parameter name=\"InterventionPriorite\">"+interventionPriorite+"</Parameter>\n"+ 
       "<Parameter name=\"InterventionURLExterieure\">"+interventionURLExterieure.replaceAll("&", "&amp;")+"</Parameter>\n"+ 
       "<Parameter name=\"InterventionURLExterieureParametres\">"+interventionURLExterieureParametres.replaceAll("&", "&amp;")+"</Parameter>\n"+ 
      "</Service>\n"+ 
     "</Request>\n"; 

      callService(request, args[0]); 
     } 

     public static void callService(String request, String urlDest){ 
      try { 

        /* 
        * urlDest the URL of the destination Web Service  
        */ 


        /* 
        * create a new Service instance 
        */ 
        Service serviceInstance = new Service(); 

        /* 
        * ask the Service to create a call 
        */ 
        Call call = (Call) serviceInstance.createCall(); 


        /* 
        * We tell the Call that this URL is the target endpoint to connect to 
        */ 
        call.setTargetEndpointAddress(new java.net.URL(urlDest)); 

        /* 
        * The QName uses the webservice namespace used in the WSDL file 
        * and the name of the method on the webservice that we want to execute: returnResponse 
        */ 

        call.setOperationName(new QName("http://www.crih-des-alpes.com/PcfwkWebService", "ExecuteString")); 

        /* 
        * we tell the call that we have two input parameters 
        * -- a String followed by another String -- 
        * and that we expect a String to be returned to us. 
        */ 

        call.addParameter("arg0", XMLType.XSD_STRING, ParameterMode.IN); 
        call.addParameter("arg1", XMLType.XSD_STRING, ParameterMode.IN);  
        call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING); 

        System.out.println("before invoke: "+call.toString()); 
        /* 
        * we invoke the Web Service call, passing it our parameters, 
        * wrapping in an Object array, and capture the response 
        */ 
        String response = (String) call.invoke(new Object[] {request ,"CNET_VA_DPLAN_API" });  
        System.out.println("The result : " + response); 
       // createFileResult(ret); 
       } catch (Exception e) { 
        System.err.println(e.toString()); 
       } 
     } 

    } 

하나 도움을 내가 어떻게이 예외를 해결할 수 있습니다

: 이 내 자바 코드? 비누 클라이언트를 작성

답변

0

표준 방식으로 작동 할 수 문자열의 모든 코딩 WSDL 파일

wsimport -keep -verbose http://com.company/ws/server?wsdl 

에서 클라이언트 생성을 포함하지만, 장기적으로는 정말 손실됩니다.