title: SOAP Server was unable to process request
body: <p>I have a problem about SOAP request.I want to explain what am I doing.
  This is my SOAP request.</p>
  
  <pre><code>&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://www.webserviceX.NET"&gt;
     &lt;soapenv:Header/&gt;
     &lt;soapenv:Body&gt;
         &lt;web:GetWeather&gt;
           &lt;!--Optional:--&gt;
           &lt;web:CityName&gt;Istanbul&lt;/web:CityName&gt;
           &lt;!--Optional:--&gt;
           &lt;web:CountryName&gt;Turkey&lt;/web:CountryName&gt;
         &lt;/web:GetWeather&gt;
     &lt;/soapenv:Body&gt;
  &lt;/soapenv:Envelope&gt;
  </code></pre>
  
  <p>Endpoint : <a href="http://www.webservicex.net/globalweather.asmx" rel="nofollow">http://www.webservicex.net/globalweather.asmx</a></p>
  
  <p>WSDL link : http://www.webservicex.net/globalweather.asmx?WSDL</p>
  
  <p>Also this is my code.
  </p>
  
  <pre><code>public static void main(String args[]) {
      try {
          // Create SOAP Connection
          SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory
                  .newInstance();
          SOAPConnection soapConnection = soapConnectionFactory
                  .createConnection();
  
          // Send SOAP Message to SOAP Server
          String url = "http://www.webservicex.net/globalweather.asmx?WSDL";
          // SOAPMessage soapResponse =
          SOAPMessage soapResponse = soapConnection.call(createSOAPRequest(),
                  url);
  
          // Process the SOAP Response
          printSOAPResponse(soapResponse);
          soapConnection.close();
      } catch (Exception e) {
          System.err.println("Error occurred while sending SOAP Request to Server");
          e.printStackTrace();
      }
  }
  
  private static SOAPMessage createSOAPRequest() throws Exception {
      MessageFactory messageFactory = MessageFactory.newInstance();
      SOAPMessage soapMessage = messageFactory.createMessage();
      SOAPPart soapPart = soapMessage.getSOAPPart();
  
      String serverURL = "http://www.webserviceX.NET/";
  
      SOAPEnvelope envelope = soapPart.getEnvelope();
      envelope.addNamespaceDeclaration("web", serverURL);
  
      // SOAP Body
      SOAPBody soapBody = envelope.getBody();
      SOAPElement soapElement = soapBody.addChildElement("GetWeather", "web");
      SOAPElement soapElement1 = soapElement.addChildElement("CityName",
              "web");
      soapElement1.addTextNode("Istanbul");
      SOAPElement soapElement2 = soapElement.addChildElement("CountryName",
              "web");
      soapElement2.addTextNode("Turkey");
  
      MimeHeaders headers = soapMessage.getMimeHeaders();
      headers.addHeader("SOAPAction", serverURL + "GetWeather");
      soapMessage.saveChanges();
      return soapMessage;
  }
  
  /**
   * Method used to print the SOAP Response
   */
  private static void printSOAPResponse(SOAPMessage soapResponse)
          throws Exception {
      TransformerFactory transformerFactory = TransformerFactory
              .newInstance();
      Transformer transformer = transformerFactory.newTransformer();
      Source sourceContent = soapResponse.getSOAPPart().getContent();
      System.out.print("\nResponse SOAP Message = ");
      StreamResult result = new StreamResult(System.out);
      transformer.transform(sourceContent, result);
  }}
  </code></pre>
  
  <p>As a result, I got "Server was unable to process.Procedure or function 'getWeather' expects parameter '@CountryName', which was not supplied."</p>
  
  <p>What does it mean ? Why am I taking this exception ?</p>
  
  <p>Any suggestion about solution ?</p>