Title: RE: Design review and general axis questions
   what does the error means?
I appreciate your help!!
 
Aria.
 

I have 2 files, one client and one service, I run it from the command line:
java clientaxis.Battle.message.CatalogPublisherServiceClient
 

I notice that when I publish it (WSDL file), the "main" function is not published even though I use  value="*"  I see there only
CatalogPublisherService (wsdl)
publishCatalog
 
the error is:
D:\xml-axis>java clientaxis.Battle.message.CatalogPublisherServiceClient
Exception in thread "main" AxisFault
 faultCode: {http://xml.apache.org/axis/}Server.userException
 faultString: java.lang.NoSuchMethodException: clientaxis.Battle.message.Catalog
PublisherService.CATALOG(org.w3c.dom.Document)tried class:  clientaxis.Battle.me
ssage.CatalogPublisherService, method name:  CATALOG.
 faultActor: null
 faultDetail:
   stackTrace: java.lang.NoSuchMethosException: clientaxis.Battle.message.CatalogPublisherService.CATALOG(org.w3c.dom.Document)tried class: clientaxis.Battle.message.CatalogPublisherService, method name: CATALOG.
 at org.apache.axis.providers.java.MsgProvider.processmessage(MsgProvider.java:173)........
..............
 
here are the files:
//CatalogPublisherService.java
 package clientaxis.Battle.message;
 
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import org.w3c.dom.Node;
import org.w3c.dom.Text;
import java.util.Vector;
import java.util.Date;
import java.text.SimpleDateFormat;
import org.apache.axis.MessageContext ;
import org.apache.axis.utils.XMLUtils;
import org.apache.axis.message.SOAPBodyElement;
 
import java.io.*;
 
public class CatalogPublisherService {
  public Element[] publishCatalog(MessageContext context,
    Vector soapBodyElements) throws Exception {
    Element soapBody = (Element) soapBodyElements.get(0);
    NodeList productList = soapBody.getElementsByTagName("PRODUCT");
    //Get the count of <PRODUCT> elements in the NodeList
    int productCount = productList.getLength();
    //Call back-end code
 
    //Start Building Response Document
    //Get a DocumentBuilder objec
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    factory.setNamespaceAware(true);
    DocumentBuilder builder = factory.newDocumentBuilder();
    //Start creating the Response
    //Creat a new DOM Document
    Document responseDoc = builder.newDocument();
 
    //Create the namespace aware root Element <CATALOGUPDATE>
    Element resRoot = responseDoc.createElementNS("http://
 
www.wrox.com/axis/catalogupdate","CATALOGUPDATE");
    resRoot.setPrefix("CU");
 
    //Create the ITEMCOUNT element
    Element itemCount = responseDoc.createElement("ITEMCOUNT");
    Text itemCountText = responseDoc.createTextNode(String.valueOf  (productCount));
 
    //Create the DATE RECEIVED element
    Element dateReceived = responseDoc.createElement("DATERECEIVED");
    SimpleDateFormat fmt = new SimpleDateFormat("MM/dd/yyyy");
    String date = fmt.format(new Date());
    Text dateReceivedText = responseDoc.createTextNode(date);
 
    //Append the child elements appropriately
    resRoot.appendChild(itemCount);
    itemCount.appendChild(itemCountText);
    resRoot.appendChild(dateReceived);
    dateReceived.appendChild(dateReceivedText);
 
    Element[] result = new Element[1];
    result[0] = resRoot;
 
    return(result);
  }
}
 

Client File:
 

/ CatalogPublisherServiceClient.java
 
package clientaxis.Battle.message;
 
import org.w3c.dom.Element;
import org.apache.axis.client.Service;
import org.apache.axis.client.Call;
import org.apache.axis.message.SOAPBodyElement;
import org.apache.axis.utils.Options;
import org.apache.axis.utils.XMLUtils;
 
import java.io.FileInputStream;
import java.net.URL;
import java.util.Vector;
 
public class CatalogPublisherServiceClient {
 
  public static void main(String[] args) throws Exception {
 
    String endpointURL = "http://localhost:8080/axis/services/CatalogPublisherService";
    Service service = new Service();
    Call call = (Call) service.createCall();
    call.setTargetEndpointAddress(new URL(endpointURL));
 
    SOAPBodyElement[] reqSOAPBodyElements = new SOAPBodyElement[1];
 
    reqSOAPBodyElements[0] = new SOAPBodyElement(XMLUtils.newDocument(new java.io.FileInputStream(new java.io.File("D:\\xml-axis\\clientaxis\\Battle\\message\\catalog.xml"))).getDocumentElement());
 
    Vector resSOAPBodyElements = (Vector) call.invoke(reqSOAPBodyElements);
    SOAPBodyElement resSOAPBodyElement = null;
    resSOAPBodyElement = (SOAPBodyElement) resSOAPBodyElements.get(0);
    System.out.println(XMLUtils.ElementToString(resSOAPBodyElement.getAsDOM()));
  }
}
 

XML document used to send to the service:
 
<CATALOG xmlns="http://www.wrox.com/axis/catalog">
  <DOCUMENTINFO>
    <DATE>02/15/2002</DATE>
  </DOCUMENTINFO>
  <SUPPLIERDETAILS>
    <SUPPLIERID>12345-56789</SUPPLIERID>
    <SUPPLIERCONTACTEMAIL>[EMAIL PROTECTED]</SUPPLIERCONTACTEMAIL>
  </SUPPLIERDETAILS>
  <PRODUCTLIST>
    <PRODUCT>
      <SUPPLIER-PRODUCTSKU>SKU-1</SUPPLIER-PRODUCTSKU>
      <PRODUCTDESC>Toyota Spark Plug</PRODUCTDESC>
      <PRODUCTPRICE>10.99</PRODUCTPRICE>
      <PRODUCTUOM>Each</PRODUCTUOM>
    </PRODUCT>
    <PRODUCT>
     <SUPPLIER-PRODUCTSKU>SKU-2</SUPPLIER-PRODUCTSKU>
     <PRODUCTDESC>Toyota Wiper</PRODUCTDESC>
     <PRODUCTPRICE>2.99</PRODUCTPRICE>
     <PRODUCTUOM>Each</PRODUCTUOM>
    </PRODUCT>
  </PRODUCTLIST>
</CATALOG>
 

this is the deployee desc:
 
<deployment xmlns="http://xml.apache.org/axis/wsdd/"
      xmlns:java="http://xml.apache.org/axis/wsdd/providers/java"
      xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance">
  <service name="CatalogPublisherService" provider="java:MSG">
    <parameter name="className" value="clientaxis.Battle.message.CatalogPublisherService"/>
    <parameter name="allowedMethods" value="*" />
  </service>
</deployment>
 
 

Reply via email to