2 Replies Latest reply: Aug 13, 2008 10:27 AM by 843785 RSS

    GET WSDL METHOD

    843785
      hello everybody, I am trying to use a web service method and get outprint in xml. My codes are;
      package webpazar;
      
      
      import java.io.IOException;
      import java.io.PrintWriter;
      import javax.servlet.*;
      import javax.servlet.http.*;
      import javax.xml.soap.Node;
      import webpazar.BankalariVerResponse.BankalariVerResult;
      
      
      
      public class NewServlet extends HttpServlet {
      
       
          protected void processRequest(HttpServletRequest request, HttpServletResponse response)
          throws ServletException, IOException {
              response.setContentType("text/html;charset=UTF-8");
              PrintWriter out = response.getWriter();
              try {
            
               webpazar.Service service = new Service();
               out.println(service.getWSDLDocumentLocation());
               out.println("<br/>");
          
             BankalariVerResult banks=service.getServiceSoap().bankalariVer();
             out.println(banks);
      
             Node kod=(Node) service.getServiceSoap().bankalariVer();
             out.println("<br/>");
             out.println(kod);
           
             
            
                    
                  
             }}
      the output is:
      http://www.globalodemenoktasi.com/webservis/odeme/service.asmx?WSDL 
      webpazar.BankalariVerResponse$BankalariVerResult@115fbb0
      The web Service URL: http://www.globalodemenoktasi.com/webservis/odeme/service.asmx?WSDL


      when I call the BankalariVer() method, the program must print a xml file like;
      <banka adi="Se?iniz.." kodu="0" /><banka adi="Yap? Ve Kredi Bankas?"
      kodu="13814" /><banka adi="Garanti Bankas?" kodu="13828" /><banka
      adi="Finansbank" kodu="13842" /><banka adi="Vak?fbank" kodu="13885" /><banka
      adi="HSBC" kodu="13899" /><banka adi="?? Bankas?" kodu="13786" /><banka
      adi="Akbank" kodu="13800" />
      But I could not get this printout. How can I get this xml printout??


      Also I got some codes from .NET, but xmlNode cannot work in java
      webpazar.Service servis = new webpazar.Service();
      XmlNode bankalar = servis.BankalariVer();
      help help help????? please

      Edited by: center15 on Aug 13, 2008 5:31 AM
        • 1. Re: GET WSDL METHOD
          843785
          Your output shows the correct location of your wsdl and also it outputs the reference for banks.

          We do not know how your BankalariVerResult class is implemented and you need to check if it has toString()
          or some other method that outputs the xml.

          you may have to call like,

          banks.methodThatWritesXml();
          • 2. Re: GET WSDL METHOD
            843785
             public static void main(String[] args) {
                    try { 
                        ahmet.mehmet.as.Service service = new ahmet.mehmet.as.Service();
                        ahmet.mehmet.as.ServiceSoap port = service.getServiceSoap();
                        ahmet.mehmet.as.BankalariVerResponse.BankalariVerResult result = port.bankalariVer();
                        System.out.println("Result = "+result);
            output is:

            Result = ahmet.mehmet.as.BankalariVerResponse$BankalariVerResult@14866


            I would like to get list of banks

            the bankalariVer methods is:
            package ahmet.mehmet.as;
            
            import javax.xml.bind.annotation.XmlAccessType;
            import javax.xml.bind.annotation.XmlAccessorType;
            import javax.xml.bind.annotation.XmlRootElement;
            import javax.xml.bind.annotation.XmlType;
            
            
            /**
             * <p>Java class for anonymous complex type.
             * 
             * <p>The following schema fragment specifies the expected content contained within this class.
             * 
             * <pre>
             * <complexType>
             *   <complexContent>
             *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
             *     </restriction>
             *   </complexContent>
             * </complexType>
             * </pre>
             * 
             * 
             */
            @XmlAccessorType(XmlAccessType.FIELD)
            @XmlType(name = "")
            @XmlRootElement(name = "BankalariVer")
            public class BankalariVer {
            
            
            }
            bankalariVerResponse method is:
            package ahmet.mehmet.as;
            
            import java.util.ArrayList;
            import java.util.List;
            import javax.xml.bind.annotation.XmlAccessType;
            import javax.xml.bind.annotation.XmlAccessorType;
            import javax.xml.bind.annotation.XmlAnyElement;
            import javax.xml.bind.annotation.XmlElement;
            import javax.xml.bind.annotation.XmlMixed;
            import javax.xml.bind.annotation.XmlRootElement;
            import javax.xml.bind.annotation.XmlType;
            
            
            /**
             * <p>Java class for anonymous complex type.
             * 
             * <p>The following schema fragment specifies the expected content contained within this class.
             * 
             * <pre>
             * <complexType>
             *   <complexContent>
             *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
             *       <sequence>
             *         <element name="BankalariVerResult" minOccurs="0">
             *           <complexType>
             *             <complexContent>
             *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
             *                 <sequence>
             *                   <any/>
             *                 </sequence>
             *               </restriction>
             *             </complexContent>
             *           </complexType>
             *         </element>
             *       </sequence>
             *     </restriction>
             *   </complexContent>
             * </complexType>
             * </pre>
             * 
             * 
             */
            @XmlAccessorType(XmlAccessType.FIELD)
            @XmlType(name = "", propOrder = {
                "bankalariVerResult"
            })
            @XmlRootElement(name = "BankalariVerResponse")
            public class BankalariVerResponse {
            
                @XmlElement(name = "BankalariVerResult")
                protected BankalariVerResponse.BankalariVerResult bankalariVerResult;
            
                /**
                 * Gets the value of the bankalariVerResult property.
                 * 
                 * @return
                 *     possible object is
                 *     {@link BankalariVerResponse.BankalariVerResult }
                 *     
                 */
                public BankalariVerResponse.BankalariVerResult getBankalariVerResult() {
                    return bankalariVerResult;
                }
            
                /**
                 * Sets the value of the bankalariVerResult property.
                 * 
                 * @param value
                 *     allowed object is
                 *     {@link BankalariVerResponse.BankalariVerResult }
                 *     
                 */
                public void setBankalariVerResult(BankalariVerResponse.BankalariVerResult value) {
                    this.bankalariVerResult = value;
                }
            
            
                /**
                 * <p>Java class for anonymous complex type.
                 * 
                 * <p>The following schema fragment specifies the expected content contained within this class.
                 * 
                 * <pre>
                 * <complexType>
                 *   <complexContent>
                 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
                 *       <sequence>
                 *         <any/>
                 *       </sequence>
                 *     </restriction>
                 *   </complexContent>
                 * </complexType>
                 * </pre>
                 * 
                 * 
                 */
                @XmlAccessorType(XmlAccessType.FIELD)
                @XmlType(name = "", propOrder = {
                    "content"
                })
                public static class BankalariVerResult {
            
                    @XmlMixed
                    @XmlAnyElement(lax = true)
                    protected List<Object> content;
            
                    /**
                     * Gets the value of the content property.
                     * 
                     * <p>
                     * This accessor method returns a reference to the live list,
                     * not a snapshot. Therefore any modification you make to the
                     * returned list will be present inside the JAXB object.
                     * This is why there is not a <CODE>set</CODE> method for the content property.
                     * 
                     * <p>
                     * For example, to add a new item, do as follows:
                     * <pre>
                     *    getContent().add(newItem);
                     * </pre>
                     * 
                     * 
                     * <p>
                     * Objects of the following type(s) are allowed in the list
                     * {@link Object }
                     * {@link String }
                     * 
                     * 
                     */
                    public List<Object> getContent() {
                        if (content == null) {
                            content = new ArrayList<Object>();
                        }
                        return this.content;
                    }
            
                }
            
            }
            How can I get the list of banks???


            my web service manager give the .net codes, they dont know java