Java 服务器未识别HTTP标头SOAPAction的值:“0”&引用;

Java 服务器未识别HTTP标头SOAPAction的值:“0”&引用;,java,c#,web-services,soap,Java,C#,Web Services,Soap,我试图从java应用程序调用web服务,当我试图调用它时,我犯了下一个错误(web服务在c#下): 我打电话的代码是: public String enviar_y_obtener_string() { try { SOAPConnectionFactory scf = SOAPConnectionFactory.newInstance(); SOAPConnection co

我试图从java应用程序调用web服务,当我试图调用它时,我犯了下一个错误(web服务在c#下):

我打电话的代码是:

public String enviar_y_obtener_string()   {


            try
            {
                SOAPConnectionFactory scf = SOAPConnectionFactory.newInstance();
                SOAPConnection connection = scf.createConnection();

                //Crea el mensaje
                MessageFactory mf = MessageFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
                SOAPMessage message = mf.createMessage();


                //Crea las partes del mensaje       
                SOAPPart soapPart = message.getSOAPPart();
                SOAPEnvelope envelope = soapPart.getEnvelope();

                SOAPBody body = envelope.getBody();

                System.out.println("El servidor en enviar_y_obtener_string es:"+servidor+" y el método es:"+metodo);
                //Name n = envelope.createName(metodo,"",servidor);
                Name n = envelope.createName(metodo,"","http://localhost:3624/");   
                SOAPBodyElement soapBodyElement =body.addBodyElement(n);

                for(int i=0;i<lista_nombre_parametros.size();i++)
                {

                    SOAPElement soapElement = soapBodyElement.addChildElement(lista_nombre_parametros.get(i).toString());
                    System.out.println("El nombre del parámetro es:"+lista_nombre_parametros.get(i).toString());
                    int tipo=Integer.valueOf(lista_tipo_parametro.get(i).toString()).intValue();
                    if(tipo==IdTipoCadena){

                        soapElement.addTextNode(lista_valores_parametros.get(i).toString());
                        System.out.println("El valor es:"+ lista_valores_parametros.get(i).toString());
                    }
                    else
                    {
                        SOAPFactory soapFactory = SOAPFactory.newInstance();
                        Name nodeName = envelope.createName("nodo");
                        SOAPElement soapElementint=soapElement.addChildElement(nodeName);
                        ArrayList arraydev=(ArrayList)lista_valores_parametros.get(i);
                        for(int j=0;j<arraydev.size();j++)
                        {
                            Name name3 = envelope.createName("carlos");
                            SOAPElement soapElementhijo=soapElementint.addChildElement(name3);  
                            soapElementhijo.addTextNode("p");

                        }
                    }

                }



                message.setProperty(Call.SOAPACTION_USE_PROPERTY, new Boolean( true ));
                message.setProperty(Call.SOAPACTION_URI_PROPERTY,url);


                String serverURI = soapAction;


                url=leerPropiedades()[2];

                //Establece la URL del destino
                URL endpoint = new URL(url);

                //Envía el mensaje
                System.out.println("Endpoint es:"+endpoint);
                System.out.println(message.getMimeHeaders());
                String msg;
                ByteArrayOutputStream baos = new ByteArrayOutputStream();
                message.writeTo(baos);
                msg = baos.toString();
                System.out.println("msg es:"+msg);

                MimeHeaders hd = message.getMimeHeaders();
                hd.addHeader("Content-Type", "text/xml; charset=utf-8");
                hd.addHeader("soapAction",soapAction+"getConfig");


                message.saveChanges();
                SOAPMessage response = connection.call(message, endpoint);

                //Cierra la conexión
                connection.close();

                //Obtiene los resultados
                TransformerFactory tf = TransformerFactory.newInstance();
                System.out.println("He pasado tf y el response es:"+response.getSOAPBody().getFirstChild().getTextContent());
                return response.getSOAPBody().getFirstChild().getTextContent();

            }
            catch (Exception ex) 
            {
                ex.printStackTrace();
                return "";
            }


        }
[WebService(Namespace = "http://localhost:3624/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Soa : System.Web.Services.WebService
{
   public Soa()
   {
    //Eliminar la marca de comentario de la línea siguiente si utiliza los componentes diseñados 
    //InitializeComponent(); 
   }
   [WebMethod]

   public string getConfig(string id)
   {
      Datos.Depuracion.setDepuracion("Entrando en getConfig");
      ConfigSOA configuracion = new ConfigSOA();
      String correo = System.Configuration.ConfigurationManager.AppSettings["Correo"];
      String password = System.Configuration.ConfigurationManager.AppSettings["PwdCorreo"];
      try
      {

         Datos.Depuracion.setDepuracion("Peticion de configuracion. ID=" + id);
         if (Int64.Parse(id) > 0)
         {
            //Almacenamos resultados
            String x;
            x = configuracion.getXMLConfig(Int64.Parse(id));

            return (x);
         }
         else
         {
            //Es una prueba
            String x;
            x = (configuracion.getXMLConfigPrueba((-1) * Int64.Parse(id)));

            Datos.Depuracion.setDepuracion(x);
            return x;
         }
     }
     catch (Exception e)
     {

        Email depuracion = new Email(correo, correo, "Depuracion catch", e.Message);
        return null;
     }
  }
POST /web/soa/soa.asmx HTTP/1.1
Host: localhost
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://localhost:3624/getConfig"

<?xml version="1.0" encoding="utf-8"?>
  <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
 <soap:Body>
  <getConfig xmlns="http://localhost:3624/">
    <id>string</id>
  </getConfig>
</soap:Body>
Web服务正在等待的请求示例如下:

public String enviar_y_obtener_string()   {


            try
            {
                SOAPConnectionFactory scf = SOAPConnectionFactory.newInstance();
                SOAPConnection connection = scf.createConnection();

                //Crea el mensaje
                MessageFactory mf = MessageFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
                SOAPMessage message = mf.createMessage();


                //Crea las partes del mensaje       
                SOAPPart soapPart = message.getSOAPPart();
                SOAPEnvelope envelope = soapPart.getEnvelope();

                SOAPBody body = envelope.getBody();

                System.out.println("El servidor en enviar_y_obtener_string es:"+servidor+" y el método es:"+metodo);
                //Name n = envelope.createName(metodo,"",servidor);
                Name n = envelope.createName(metodo,"","http://localhost:3624/");   
                SOAPBodyElement soapBodyElement =body.addBodyElement(n);

                for(int i=0;i<lista_nombre_parametros.size();i++)
                {

                    SOAPElement soapElement = soapBodyElement.addChildElement(lista_nombre_parametros.get(i).toString());
                    System.out.println("El nombre del parámetro es:"+lista_nombre_parametros.get(i).toString());
                    int tipo=Integer.valueOf(lista_tipo_parametro.get(i).toString()).intValue();
                    if(tipo==IdTipoCadena){

                        soapElement.addTextNode(lista_valores_parametros.get(i).toString());
                        System.out.println("El valor es:"+ lista_valores_parametros.get(i).toString());
                    }
                    else
                    {
                        SOAPFactory soapFactory = SOAPFactory.newInstance();
                        Name nodeName = envelope.createName("nodo");
                        SOAPElement soapElementint=soapElement.addChildElement(nodeName);
                        ArrayList arraydev=(ArrayList)lista_valores_parametros.get(i);
                        for(int j=0;j<arraydev.size();j++)
                        {
                            Name name3 = envelope.createName("carlos");
                            SOAPElement soapElementhijo=soapElementint.addChildElement(name3);  
                            soapElementhijo.addTextNode("p");

                        }
                    }

                }



                message.setProperty(Call.SOAPACTION_USE_PROPERTY, new Boolean( true ));
                message.setProperty(Call.SOAPACTION_URI_PROPERTY,url);


                String serverURI = soapAction;


                url=leerPropiedades()[2];

                //Establece la URL del destino
                URL endpoint = new URL(url);

                //Envía el mensaje
                System.out.println("Endpoint es:"+endpoint);
                System.out.println(message.getMimeHeaders());
                String msg;
                ByteArrayOutputStream baos = new ByteArrayOutputStream();
                message.writeTo(baos);
                msg = baos.toString();
                System.out.println("msg es:"+msg);

                MimeHeaders hd = message.getMimeHeaders();
                hd.addHeader("Content-Type", "text/xml; charset=utf-8");
                hd.addHeader("soapAction",soapAction+"getConfig");


                message.saveChanges();
                SOAPMessage response = connection.call(message, endpoint);

                //Cierra la conexión
                connection.close();

                //Obtiene los resultados
                TransformerFactory tf = TransformerFactory.newInstance();
                System.out.println("He pasado tf y el response es:"+response.getSOAPBody().getFirstChild().getTextContent());
                return response.getSOAPBody().getFirstChild().getTextContent();

            }
            catch (Exception ex) 
            {
                ex.printStackTrace();
                return "";
            }


        }
[WebService(Namespace = "http://localhost:3624/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Soa : System.Web.Services.WebService
{
   public Soa()
   {
    //Eliminar la marca de comentario de la línea siguiente si utiliza los componentes diseñados 
    //InitializeComponent(); 
   }
   [WebMethod]

   public string getConfig(string id)
   {
      Datos.Depuracion.setDepuracion("Entrando en getConfig");
      ConfigSOA configuracion = new ConfigSOA();
      String correo = System.Configuration.ConfigurationManager.AppSettings["Correo"];
      String password = System.Configuration.ConfigurationManager.AppSettings["PwdCorreo"];
      try
      {

         Datos.Depuracion.setDepuracion("Peticion de configuracion. ID=" + id);
         if (Int64.Parse(id) > 0)
         {
            //Almacenamos resultados
            String x;
            x = configuracion.getXMLConfig(Int64.Parse(id));

            return (x);
         }
         else
         {
            //Es una prueba
            String x;
            x = (configuracion.getXMLConfigPrueba((-1) * Int64.Parse(id)));

            Datos.Depuracion.setDepuracion(x);
            return x;
         }
     }
     catch (Exception e)
     {

        Email depuracion = new Email(correo, correo, "Depuracion catch", e.Message);
        return null;
     }
  }
POST /web/soa/soa.asmx HTTP/1.1
Host: localhost
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://localhost:3624/getConfig"

<?xml version="1.0" encoding="utf-8"?>
  <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
 <soap:Body>
  <getConfig xmlns="http://localhost:3624/">
    <id>string</id>
  </getConfig>
</soap:Body>
POST/web/soa/soa.asmx HTTP/1.1
主机:本地主机
内容类型:text/xml;字符集=utf-8
内容长度:长度
SOAPAction:“http://localhost:3624/getConfig"
一串

我的信息要求的是:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
   <SOAP-ENV:Header/>
     <SOAP-ENV:Body>
       <getConfig xmlns="http://localhost:3624/">
         <id>1644</id>
       </getConfig>
     </SOAP-ENV:Body>
 </SOAP-ENV:Envelope>

1644

有什么问题吗?。感谢并问候

我为解决此问题所做的是在获取正文后在代码顶部编写getMimeHeader和addhear