• bharat004.is091.3910779915252478E12
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 4
    Replies
<apex:page controller="Xmlretrive" >
    <apex:form >
    <script type="text/javascript">
      function doSearch() {
        searchServer(
          document.getElementById("s1").value,
          document.getElementById("s2").value,
          document.getElementById("s3").value,
          );
      }
     </script>
         
    <apex:actionFunction name="searchServer" action="{!getXml}" rerender="output,resoutput" >
          <apex:param name="s1" value="" />
          <apex:param name="s1" value="" />
          <apex:param name="s1" value="" />         
      </apex:actionFunction>
        <apex:pageBlock >
            <apex:pageBlockButtons location="top">
                <apex:commandButton value="Click here to submit" action="{!submit}" reRender="output,resoutput" />
                       
            </apex:pageBlockButtons>
            <apex:pageBlockSection columns="1">
                <Apex:pageBlockSectionItem >
                    <apex:outputLabel >Enter the username :</apex:outputLabel>
                    <apex:inputText id="s1" value="{!userName}" />
                </Apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel >Password :</apex:outputLabel>
                    <apex:inputSecret id="s2" value="{!password}" />
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel >Oauth URL</apex:outputLabel>
                    <apex:inputText id="s3" value="{!auth}" />
                </apex:pageBlockSectionItem>
            </apex:pageBlockSection>
        </apex:pageBlock>
----------------------
public class Xmlretrive {
  
     public String Xml{
        get;
        set;
    }
   
    public String xmlOutput {
        get;
        set;
    }
    String simple = 'bharath';

    public String auth {
        get;
        set;
    }
    public String password {
        get;
        set;
    }
    public String userName {
        get;
        set;
    }
    public boolean displayxml {
        get;
        set;
    }
    public Xmlretrive() {
        displayxml = false;
  
    }
    public PageReference submit( ) {
        displayxml = true;
        getXml(userName,password,auth );
        if (userName == null) {
            userName = 'Write here';
        } else {
            userName = userName;
            password = password;
            auth = auth;
        }
        return null;
    }
    public PageReference getXml() {
        String userName = Apexpages.currentPage().getParameters().get('s1');
        String password = Apexpages.currentPage().getParameters().get('s2');
        String auth = Apexpages.currentPage().getParameters().get('s3');
              
        XmlStreamWriter w = new XmlStreamWriter();
        w.writeStartDocument(null, '1.0');
        w.writeProcessingInstruction('target', 'data');
        w.writeStartElement('', 'attrs','http://www.sap.com/rws/bip');
        w.writeNamespace('', 'http://www.sap.com/rws/bip' );
        w.writeStartElement('', 'attr', 'http://www.sap.com/rws/bip' );
        w.writeAttribute(null, null,'name', 'username');
        w.writeAttribute(null, null,'type', 'string');
        w.writeCharacters(username);
        w.writeEndElement();
        w.writeStartElement('', 'attr', 'http://www.sap.com/rws/bip' );
        w.writeAttribute(null, null, 'name', 'password');
        w.writeCharacters(password);
        w.writeEndElement();
        w.writeStartElement('', 'attr', 'http://www.sap.com/rws/bip' );
        w.writeAttribute(null, null,'name', 'auth');
        w.writeAttribute(null, null, 'type', 'string');
        w.writeAttribute(null, null,'possibilities','secEnterprise,secLDAP,secWinAD,secSAPR3' );
        w.writeCharacters(auth);
        w.writeEndElement();
        w.writeEndElement();
        w.writeEndDocument();
        String xmlOutput = w.getXmlString();
        w.close();
       
        //string test = ' <some xml format data>';
        // otherwise we hit a limit of 32000

       
        //System.debug(xmlOutput);
        return null;
    }
public class Xmlretrive {
  
   
    public String xmlOutput {
        get;
        set;
    }
 
    public String auth {
        get;
        set;
    }
    public String password {
        get;
        set;
    }
    public String userName {
        get;
        set;
    }
    public boolean displayxml {
        get;
        set;
    }
    public Xmlretrive() {
        displayxml = false;
  
    }
    public PageReference submit() {
        displayxml = true;
        if (userName == null) {
            userName = 'Write here';
        } else {
            userName = userName;
            password = password;
            auth = auth;
        }
        return null;
    }
    public String getXml() {
         HttpRequest req = new HttpRequest();
        HttpResponse res = new HttpResponse();
        Http http = new Http();      
              
        XmlStreamWriter w = new XmlStreamWriter();
        w.writeStartDocument(null, '1.0');
        w.writeProcessingInstruction('target', 'data');
        w.writeStartElement('', 'attrs','http://www.sap.com/rws/bip');
        w.writeNamespace('', 'http://www.sap.com/rws/bip' );
        w.writeStartElement('', 'attr', 'http://www.sap.com/rws/bip' );
        w.writeAttribute(null, null,'name', 'username');
        w.writeAttribute(null, null,'type', 'string');
        w.writeCharacters(username);
        w.writeEndElement();
        w.writeStartElement('', 'attr', 'http://www.sap.com/rws/bip' );
        w.writeAttribute(null, null, 'name', 'password');
        w.writeCharacters(password);
        w.writeEndElement();
        w.writeStartElement('', 'attr', 'http://www.sap.com/rws/bip' );
        w.writeAttribute(null, null,'name', 'auth');
        w.writeAttribute(null, null, 'type', 'string');
        w.writeAttribute(null, null,'possibilities','secEnterprise,secLDAP,secWinAD,secSAPR3' );
        w.writeCharacters(auth);
        w.writeEndElement();
        w.writeEndElement();
        w.writeEndDocument();
        String xmlOutput = w.getXmlString();
        w.close();
       
        //string test = ' <some xml format data>';
        req.setEndpoint('http://www.my-end-point.aspx');
        req.setMethod('POST');
        req.setBody(xmlOutput);
         req.setCompressed(true); // otherwise we hit a limit of 32000

        try {
            res = http.send(req);
        } catch(System.CalloutException e) {
            System.debug('Callout error: '+ e);
            System.debug(res.getBody());
        }
        //System.debug(xmlOutput);
        return xmlOutput;
    }
}

Visual force page
<apex:page controller="Xmlretrive">
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockButtons location="top">
                <apex:commandButton value="Click here to submit" action="{!submit}" reRender="output,resoutput" />

            </apex:pageBlockButtons>
            <apex:pageBlockSection columns="1">
                <Apex:pageBlockSectionItem >
                    <apex:outputLabel >Enter the username :</apex:outputLabel>
                    <apex:inputText id="s1" value="{!userName}" />
                </Apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel >Password :</apex:outputLabel>
                    <apex:inputSecret id="s2" value="{!password}" />
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel >Oauth URL</apex:outputLabel>
                    <apex:inputText id="s3" value="{!auth}" />
                </apex:pageBlockSectionItem>
            </apex:pageBlockSection>
        </apex:pageBlock>

        <apex:outputPanel id="output">

            <apex:pageBlock id="chkoutput" title="Output" rendered="{!displayxml}">
                <apex:pageBlockButtons location="top">
                    <apex:commandButton value="View XML" reRender="DisplayXML" />

                </apex:pageBlockButtons>
                
                <apex:pageBlockSection columns="1">
                    <Apex:pageBlockSectionItem >
                        <apex:outputLabel >User Name</apex:outputLabel>
                        <apex:outputLabel >{!userName }</apex:outputLabel>
                    </Apex:pageBlockSectionItem>
                    <Apex:pageBlockSectionItem >
                        <apex:outputLabel >Password</apex:outputLabel>
                        <apex:outputLabel >{!password}</apex:outputLabel>
                    </Apex:pageBlockSectionItem>

                    <Apex:pageBlockSectionItem >
                        <apex:outputLabel >Oauth URL</apex:outputLabel>
                        <apex:outputLabel >{!auth}</apex:outputLabel>
                    </Apex:pageBlockSectionItem>
                </Apex:pageBlockSection>

            </apex:pageBlock>
        </apex:outputPanel>
       


        <apex:outputPanel id="DisplayXML">
            <apex:outputPanel rendered="{!displayxml}">
                <apex:outputText value="{!Xml}"><h1> Request XML output</h1></apex:outputText><br/>
            </apex:outputPanel>
        </apex:outputPanel>
      
    </apex:form>
</apex:page>
<apex:page controller="Xmlretrive" >
    <apex:form >
        <apex:outputText >Enter the username:
            <apex:inputText id="s1" value="{!userName}" />
        </apex:outputText><br/>
        <apex:outputText >Password :
            <apex:inputSecret id="s2" value="{!password}"  />
    </apex:outputText><br/>
        <apex:outputText >auth :
            <apex:inputText id="s3" value="{!auth}" />
        </apex:outputText>           
        <apex:commandButton value="Click here to submit" action="{!submit}" reRender="attributes1,attributes2,attributes3" /><br/>
        <h1> <apex:outputText id="attributes1" value="{!userName }" /></h1>
        <h1> <apex:outputText id="attributes2" value="{!password }" /></h1>
        <h1> <apex:outputText id="attributes3" value="{!auth}" /></h1>              
        <apex:commandButton value="submit"  reRender="submit"  onclick="{!xmlOutput}"/>
                     
        <apex:actionFunction name="Method1" action="{!getXml}"  reRender="submit"/>
         <apex:outputText id="submit" value="{!xmlOutput}" >{!Xml} </apex:outputText>
                 
    </apex:form>
</apex:page>

public class Xmlretrive{

    public String xmlOutput { get; set; }
    String simple='bharath';
   
    public String auth { get; set; }

    public String password { get; set; }
        
    public String userName {get; set;}
                    
    public PageReference submit() {
                  if (userName == null) {
                         userName = 'Write here';
                   } else {
                         userName = userName ;
                         password = password ;
                         auth=auth;
                      }
                     
        return null;                         
    }
     public String getXml() {
          XmlStreamWriter w = new XmlStreamWriter();
          w.writeStartDocument(null, '1.0');
          w.writeProcessingInstruction('target', 'data');
          w.writeStartElement('', 'attrs', 'http://www.sap.com/rws/bip');
          w.writeNamespace('', 'http://www.sap.com/rws/bip');
         
          w.writeStartElement('', 'attr', 'http://www.sap.com/rws/bip');
          w.writeAttribute(null, null, 'name', 'userName');
          w.writeAttribute(null, null, 'type', 'string');
          w.writeCharacters(simple);
          w.writeEndElement();
          
          w.writeStartElement('', 'attr', 'http://www.sap.com/rws/bip');
          w.writeAttribute(null, null, 'name', 'password');
          w.writeCharacters('bowrsbo4');      
          w.writeEndElement();
        
          w.writeStartElement('', 'attr', 'http://www.sap.com/rws/bip');
          w.writeAttribute(null, null, 'name', 'auth');
          w.writeAttribute(null, null, 'type', 'string');
          w.writeAttribute(null, null, 'possibilities', 'secEnterprise,secLDAP,secWinAD,secSAPR3');
          w.writeCharacters('secEnterprise');      
          w.writeEndElement();
         
          w.writeEndElement();                
          w.writeEndDocument();
          String xmlOutput = w.getXmlString();
          w.close();
          //System.debug(xmlOutput);
          return xmlOutput ;
        }      
 
}
public class Xmlretrive {
  
   
    public String xmlOutput {
        get;
        set;
    }
 
    public String auth {
        get;
        set;
    }
    public String password {
        get;
        set;
    }
    public String userName {
        get;
        set;
    }
    public boolean displayxml {
        get;
        set;
    }
    public Xmlretrive() {
        displayxml = false;
  
    }
    public PageReference submit() {
        displayxml = true;
        if (userName == null) {
            userName = 'Write here';
        } else {
            userName = userName;
            password = password;
            auth = auth;
        }
        return null;
    }
    public String getXml() {
         HttpRequest req = new HttpRequest();
        HttpResponse res = new HttpResponse();
        Http http = new Http();      
              
        XmlStreamWriter w = new XmlStreamWriter();
        w.writeStartDocument(null, '1.0');
        w.writeProcessingInstruction('target', 'data');
        w.writeStartElement('', 'attrs','http://www.sap.com/rws/bip');
        w.writeNamespace('', 'http://www.sap.com/rws/bip' );
        w.writeStartElement('', 'attr', 'http://www.sap.com/rws/bip' );
        w.writeAttribute(null, null,'name', 'username');
        w.writeAttribute(null, null,'type', 'string');
        w.writeCharacters(username);
        w.writeEndElement();
        w.writeStartElement('', 'attr', 'http://www.sap.com/rws/bip' );
        w.writeAttribute(null, null, 'name', 'password');
        w.writeCharacters(password);
        w.writeEndElement();
        w.writeStartElement('', 'attr', 'http://www.sap.com/rws/bip' );
        w.writeAttribute(null, null,'name', 'auth');
        w.writeAttribute(null, null, 'type', 'string');
        w.writeAttribute(null, null,'possibilities','secEnterprise,secLDAP,secWinAD,secSAPR3' );
        w.writeCharacters(auth);
        w.writeEndElement();
        w.writeEndElement();
        w.writeEndDocument();
        String xmlOutput = w.getXmlString();
        w.close();
       
        //string test = ' <some xml format data>';
        req.setEndpoint('http://www.my-end-point.aspx');
        req.setMethod('POST');
        req.setBody(xmlOutput);
         req.setCompressed(true); // otherwise we hit a limit of 32000

        try {
            res = http.send(req);
        } catch(System.CalloutException e) {
            System.debug('Callout error: '+ e);
            System.debug(res.getBody());
        }
        //System.debug(xmlOutput);
        return xmlOutput;
    }
}

Visual force page
<apex:page controller="Xmlretrive">
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockButtons location="top">
                <apex:commandButton value="Click here to submit" action="{!submit}" reRender="output,resoutput" />

            </apex:pageBlockButtons>
            <apex:pageBlockSection columns="1">
                <Apex:pageBlockSectionItem >
                    <apex:outputLabel >Enter the username :</apex:outputLabel>
                    <apex:inputText id="s1" value="{!userName}" />
                </Apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel >Password :</apex:outputLabel>
                    <apex:inputSecret id="s2" value="{!password}" />
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel >Oauth URL</apex:outputLabel>
                    <apex:inputText id="s3" value="{!auth}" />
                </apex:pageBlockSectionItem>
            </apex:pageBlockSection>
        </apex:pageBlock>

        <apex:outputPanel id="output">

            <apex:pageBlock id="chkoutput" title="Output" rendered="{!displayxml}">
                <apex:pageBlockButtons location="top">
                    <apex:commandButton value="View XML" reRender="DisplayXML" />

                </apex:pageBlockButtons>
                
                <apex:pageBlockSection columns="1">
                    <Apex:pageBlockSectionItem >
                        <apex:outputLabel >User Name</apex:outputLabel>
                        <apex:outputLabel >{!userName }</apex:outputLabel>
                    </Apex:pageBlockSectionItem>
                    <Apex:pageBlockSectionItem >
                        <apex:outputLabel >Password</apex:outputLabel>
                        <apex:outputLabel >{!password}</apex:outputLabel>
                    </Apex:pageBlockSectionItem>

                    <Apex:pageBlockSectionItem >
                        <apex:outputLabel >Oauth URL</apex:outputLabel>
                        <apex:outputLabel >{!auth}</apex:outputLabel>
                    </Apex:pageBlockSectionItem>
                </Apex:pageBlockSection>

            </apex:pageBlock>
        </apex:outputPanel>
       


        <apex:outputPanel id="DisplayXML">
            <apex:outputPanel rendered="{!displayxml}">
                <apex:outputText value="{!Xml}"><h1> Request XML output</h1></apex:outputText><br/>
            </apex:outputPanel>
        </apex:outputPanel>
      
    </apex:form>
</apex:page>
<apex:page controller="Xmlretrive" >
    <apex:form >
    <script type="text/javascript">
      function doSearch() {
        searchServer(
          document.getElementById("s1").value,
          document.getElementById("s2").value,
          document.getElementById("s3").value,
          );
      }
     </script>
         
    <apex:actionFunction name="searchServer" action="{!getXml}" rerender="output,resoutput" >
          <apex:param name="s1" value="" />
          <apex:param name="s1" value="" />
          <apex:param name="s1" value="" />         
      </apex:actionFunction>
        <apex:pageBlock >
            <apex:pageBlockButtons location="top">
                <apex:commandButton value="Click here to submit" action="{!submit}" reRender="output,resoutput" />
                       
            </apex:pageBlockButtons>
            <apex:pageBlockSection columns="1">
                <Apex:pageBlockSectionItem >
                    <apex:outputLabel >Enter the username :</apex:outputLabel>
                    <apex:inputText id="s1" value="{!userName}" />
                </Apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel >Password :</apex:outputLabel>
                    <apex:inputSecret id="s2" value="{!password}" />
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel >Oauth URL</apex:outputLabel>
                    <apex:inputText id="s3" value="{!auth}" />
                </apex:pageBlockSectionItem>
            </apex:pageBlockSection>
        </apex:pageBlock>
----------------------
public class Xmlretrive {
  
     public String Xml{
        get;
        set;
    }
   
    public String xmlOutput {
        get;
        set;
    }
    String simple = 'bharath';

    public String auth {
        get;
        set;
    }
    public String password {
        get;
        set;
    }
    public String userName {
        get;
        set;
    }
    public boolean displayxml {
        get;
        set;
    }
    public Xmlretrive() {
        displayxml = false;
  
    }
    public PageReference submit( ) {
        displayxml = true;
        getXml(userName,password,auth );
        if (userName == null) {
            userName = 'Write here';
        } else {
            userName = userName;
            password = password;
            auth = auth;
        }
        return null;
    }
    public PageReference getXml() {
        String userName = Apexpages.currentPage().getParameters().get('s1');
        String password = Apexpages.currentPage().getParameters().get('s2');
        String auth = Apexpages.currentPage().getParameters().get('s3');
              
        XmlStreamWriter w = new XmlStreamWriter();
        w.writeStartDocument(null, '1.0');
        w.writeProcessingInstruction('target', 'data');
        w.writeStartElement('', 'attrs','http://www.sap.com/rws/bip');
        w.writeNamespace('', 'http://www.sap.com/rws/bip' );
        w.writeStartElement('', 'attr', 'http://www.sap.com/rws/bip' );
        w.writeAttribute(null, null,'name', 'username');
        w.writeAttribute(null, null,'type', 'string');
        w.writeCharacters(username);
        w.writeEndElement();
        w.writeStartElement('', 'attr', 'http://www.sap.com/rws/bip' );
        w.writeAttribute(null, null, 'name', 'password');
        w.writeCharacters(password);
        w.writeEndElement();
        w.writeStartElement('', 'attr', 'http://www.sap.com/rws/bip' );
        w.writeAttribute(null, null,'name', 'auth');
        w.writeAttribute(null, null, 'type', 'string');
        w.writeAttribute(null, null,'possibilities','secEnterprise,secLDAP,secWinAD,secSAPR3' );
        w.writeCharacters(auth);
        w.writeEndElement();
        w.writeEndElement();
        w.writeEndDocument();
        String xmlOutput = w.getXmlString();
        w.close();
       
        //string test = ' <some xml format data>';
        // otherwise we hit a limit of 32000

       
        //System.debug(xmlOutput);
        return null;
    }
<apex:page controller="Xmlretrive" >
    <apex:form >
        <apex:outputText >Enter the username:
            <apex:inputText id="s1" value="{!userName}" />
        </apex:outputText><br/>
        <apex:outputText >Password :
            <apex:inputSecret id="s2" value="{!password}"  />
    </apex:outputText><br/>
        <apex:outputText >auth :
            <apex:inputText id="s3" value="{!auth}" />
        </apex:outputText>           
        <apex:commandButton value="Click here to submit" action="{!submit}" reRender="attributes1,attributes2,attributes3" /><br/>
        <h1> <apex:outputText id="attributes1" value="{!userName }" /></h1>
        <h1> <apex:outputText id="attributes2" value="{!password }" /></h1>
        <h1> <apex:outputText id="attributes3" value="{!auth}" /></h1>              
        <apex:commandButton value="submit"  reRender="submit"  onclick="{!xmlOutput}"/>
                     
        <apex:actionFunction name="Method1" action="{!getXml}"  reRender="submit"/>
         <apex:outputText id="submit" value="{!xmlOutput}" >{!Xml} </apex:outputText>
                 
    </apex:form>
</apex:page>

public class Xmlretrive{

    public String xmlOutput { get; set; }
    String simple='bharath';
   
    public String auth { get; set; }

    public String password { get; set; }
        
    public String userName {get; set;}
                    
    public PageReference submit() {
                  if (userName == null) {
                         userName = 'Write here';
                   } else {
                         userName = userName ;
                         password = password ;
                         auth=auth;
                      }
                     
        return null;                         
    }
     public String getXml() {
          XmlStreamWriter w = new XmlStreamWriter();
          w.writeStartDocument(null, '1.0');
          w.writeProcessingInstruction('target', 'data');
          w.writeStartElement('', 'attrs', 'http://www.sap.com/rws/bip');
          w.writeNamespace('', 'http://www.sap.com/rws/bip');
         
          w.writeStartElement('', 'attr', 'http://www.sap.com/rws/bip');
          w.writeAttribute(null, null, 'name', 'userName');
          w.writeAttribute(null, null, 'type', 'string');
          w.writeCharacters(simple);
          w.writeEndElement();
          
          w.writeStartElement('', 'attr', 'http://www.sap.com/rws/bip');
          w.writeAttribute(null, null, 'name', 'password');
          w.writeCharacters('bowrsbo4');      
          w.writeEndElement();
        
          w.writeStartElement('', 'attr', 'http://www.sap.com/rws/bip');
          w.writeAttribute(null, null, 'name', 'auth');
          w.writeAttribute(null, null, 'type', 'string');
          w.writeAttribute(null, null, 'possibilities', 'secEnterprise,secLDAP,secWinAD,secSAPR3');
          w.writeCharacters('secEnterprise');      
          w.writeEndElement();
         
          w.writeEndElement();                
          w.writeEndDocument();
          String xmlOutput = w.getXmlString();
          w.close();
          //System.debug(xmlOutput);
          return xmlOutput ;
        }      
 
}

I have the wsdl file for enterprise edition but while creating the apex classes, its giving the following error:

Apex Generation Failed
Why is this error coming? Are there any workarounds?