• Alex85
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 2
    Replies

HI,

I have a problem with width of a page, I have already fixed the width of components in the page, but the width of the page is still too wide and menu(logout ...) is far right.

What could I do to fix it?

 

Tanks.

  • April 20, 2011
  • Like
  • 0

Hi.

I try to call my web service from javascript over sforce.apex.execute method, but I get as response the status: 500.

what I did wrong?

 

Following error I get in AJAX Toolkit Shell:

 

Request: server- /services/Soap/package/WSHelper
<textarea cols=80 rows=5 wrap=hard>&lt;se:Envelope xmlns:se="http://schemas.xmlsoap.org/soap/envelope/"&gt;&lt;se:Header xmlns:sfns="http://soap.sforce.com/schemas/package/WSHelper"/&gt;&lt;se:Body&gt;&lt;setName xmlns="http://soap.sforce.com/schemas/package/WSHelper"&gt;&lt;n&gt;Smith&lt;/n&gt;&lt;/setName&gt;&lt;/se:Body&gt;&lt;/se:Envelope&gt;</textarea>
Response : status - 500
<textarea cols=80 rows=5 wrap=hard>&lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sf="http://soap.sforce.com/2006/08/apex"&gt;&lt;soapenv:Body&gt;&lt;soapenv:Fault&gt;&lt;faultcode&gt;sf:INVALID_SESSION_ID&lt;/faultcode&gt;&lt;faultstring&gt;INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session&lt;/faultstring&gt;&lt;/soapenv:Fault&gt;&lt;/soapenv:Body&gt;&lt;/soapenv:Envelope&gt;</textarea>

 

 

here is the javascript code:

 

<script src="/soap/ajax/17.0/connection.js" type="text/javascript"></script>
<script src="/soap/ajax/17.0/apex.js" type="text/javascript"></script>

<script>
function test(){
	sforce.debug.trace=true;
	alert('test');
	var name = sforce.apex.execute("WSHelper", "setName", {n:"Smith"});
	alert(name); 
}
</script>

 

 

Here is my web service code:

 

global class WSHelper {
	webService static String getName() {
        return 'WSHelper';
   }
   
   webService static String setName(String n) {
        return n;
   }
}

 

 

and here the generated xml-file of my web service:

 

<?xml version="1.0" encoding="UTF-8"?>
<!--
 Web Services API : WSHelper
-->
<definitions targetNamespace="http://soap.sforce.com/schemas/class/WSHelper" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://soap.sforce.com/schemas/class/WSHelper">
 <types>
  <xsd:schema elementFormDefault="qualified" targetNamespace="http://soap.sforce.com/schemas/class/WSHelper">
   <xsd:element name="DebuggingInfo">
    <xsd:complexType>
     <xsd:sequence>
      <xsd:element name="debugLog" type="xsd:string"/>
     </xsd:sequence>
    </xsd:complexType>
   </xsd:element>
   <xsd:simpleType name="ID">
    <xsd:restriction base="xsd:string">
     <xsd:length value="18"/>
     <xsd:pattern value="[a-zA-Z0-9]{18}"/>
    </xsd:restriction>
   </xsd:simpleType>
   <xsd:simpleType name="LogCategory">
    <xsd:restriction base="xsd:string">
     <xsd:enumeration value="Db"/>
     <xsd:enumeration value="Workflow"/>
     <xsd:enumeration value="Validation"/>
     <xsd:enumeration value="Callout"/>
     <xsd:enumeration value="Apex_code"/>
     <xsd:enumeration value="Apex_profiling"/>
     <xsd:enumeration value="Visualforce"/>
     <xsd:enumeration value="All"/>
    </xsd:restriction>
   </xsd:simpleType>
   <xsd:simpleType name="LogCategoryLevel">
    <xsd:restriction base="xsd:string">
     <xsd:enumeration value="Internal"/>
     <xsd:enumeration value="Finest"/>
     <xsd:enumeration value="Finer"/>
     <xsd:enumeration value="Fine"/>
     <xsd:enumeration value="Debug"/>
     <xsd:enumeration value="Info"/>
     <xsd:enumeration value="Warn"/>
     <xsd:enumeration value="Error"/>
    </xsd:restriction>
   </xsd:simpleType>
   <xsd:complexType name="LogInfo">
    <xsd:sequence>
     <xsd:element name="category" type="tns:LogCategory"/>
     <xsd:element name="level" type="tns:LogCategoryLevel"/>
    </xsd:sequence>
   </xsd:complexType>
   <xsd:simpleType name="LogType">
    <xsd:restriction base="xsd:string">
     <xsd:enumeration value="None"/>
     <xsd:enumeration value="Debugonly"/>
     <xsd:enumeration value="Db"/>
     <xsd:enumeration value="Profiling"/>
     <xsd:enumeration value="Callout"/>
     <xsd:enumeration value="Detail"/>
    </xsd:restriction>
   </xsd:simpleType>
   <xsd:element name="DebuggingHeader">
    <xsd:complexType>
     <xsd:sequence>
      <xsd:element name="categories" minOccurs="0" maxOccurs="unbounded" type="tns:LogInfo"/>
      <xsd:element name="debugLevel" type="tns:LogType"/>
     </xsd:sequence>
    </xsd:complexType>
   </xsd:element>
   <xsd:element name="CallOptions">
    <xsd:complexType>
     <xsd:sequence>
      <xsd:element name="client" type="xsd:string"/>
     </xsd:sequence>
    </xsd:complexType>
   </xsd:element>
   <xsd:element name="SessionHeader">
    <xsd:complexType>
     <xsd:sequence>
      <xsd:element name="sessionId" type="xsd:string"/>
     </xsd:sequence>
    </xsd:complexType>
   </xsd:element>
   <xsd:element name="AllowFieldTruncationHeader">
    <xsd:complexType>
     <xsd:sequence>
      <xsd:element name="allowFieldTruncation" type="xsd:boolean"/>
     </xsd:sequence>
    </xsd:complexType>
   </xsd:element>
   <xsd:element name="getName">
    <xsd:complexType>
     <xsd:sequence/>
    </xsd:complexType>
   </xsd:element>
   <xsd:element name="getNameResponse">
    <xsd:complexType>
     <xsd:sequence>
      <xsd:element name="result" type="xsd:string" nillable="true"/>
     </xsd:sequence>
    </xsd:complexType>
   </xsd:element>
   <xsd:element name="setName">
    <xsd:complexType>
     <xsd:sequence>
      <xsd:element name="n" type="xsd:string" nillable="true"/>
     </xsd:sequence>
    </xsd:complexType>
   </xsd:element>
   <xsd:element name="setNameResponse">
    <xsd:complexType>
     <xsd:sequence>
      <xsd:element name="result" type="xsd:string" nillable="true"/>
     </xsd:sequence>
    </xsd:complexType>
   </xsd:element>
  </xsd:schema>
 </types>
 <!-- Message for the header parts -->
 <message name="Header">
  <part name="AllowFieldTruncationHeader" element="tns:AllowFieldTruncationHeader"/>
  <part name="CallOptions" element="tns:CallOptions"/>
  <part name="DebuggingHeader" element="tns:DebuggingHeader"/>
  <part name="DebuggingInfo" element="tns:DebuggingInfo"/>
  <part name="SessionHeader" element="tns:SessionHeader"/>
 </message>
 <!-- Operation Messages -->
 <message name="getNameRequest">
  <part element="tns:getName" name="parameters"/>
 </message>
 <message name="getNameResponse">
  <part element="tns:getNameResponse" name="parameters"/>
 </message>
 <message name="setNameRequest">
  <part element="tns:setName" name="parameters"/>
 </message>
 <message name="setNameResponse">
  <part element="tns:setNameResponse" name="parameters"/>
 </message>
 <portType name="WSHelperPortType">
  <operation name="getName">
   <input message="tns:getNameRequest"/>
   <output message="tns:getNameResponse"/>
  </operation>
  <operation name="setName">
   <input message="tns:setNameRequest"/>
   <output message="tns:setNameResponse"/>
  </operation>
 </portType>
 <binding name="WSHelperBinding" type="tns:WSHelperPortType">
  <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
  <operation name="getName">
   <soap:operation soapAction=""/>
   <input>
    <soap:header use="literal" part="SessionHeader" message="tns:Header"/>
    <soap:header use="literal" part="CallOptions" message="tns:Header"/>
    <soap:header use="literal" part="DebuggingHeader" message="tns:Header"/>
    <soap:header use="literal" part="AllowFieldTruncationHeader" message="tns:Header"/>
    <soap:body use="literal" parts="parameters"/>
   </input>
   <output>
    <soap:header use="literal" part="DebuggingInfo" message="tns:Header"/>
    <soap:body use="literal"/>
   </output>
  </operation>
  <operation name="setName">
   <soap:operation soapAction=""/>
   <input>
    <soap:header use="literal" part="SessionHeader" message="tns:Header"/>
    <soap:header use="literal" part="CallOptions" message="tns:Header"/>
    <soap:header use="literal" part="DebuggingHeader" message="tns:Header"/>
    <soap:header use="literal" part="AllowFieldTruncationHeader" message="tns:Header"/>
    <soap:body use="literal" parts="parameters"/>
   </input>
   <output>
    <soap:header use="literal" part="DebuggingInfo" message="tns:Header"/>
    <soap:body use="literal"/>
   </output>
  </operation>
 </binding>
 <service name="WSHelperService">
  <documentation/>
  <port binding="tns:WSHelperBinding" name="WSHelper">
   <soap:address location="https://na7-api.salesforce.com/services/Soap/class/WSHelper"/>
  </port>
 </service>
</definitions>

 

Thanks.

 

  • March 21, 2011
  • Like
  • 0

Hi.

I make some calculations in javascript, becouse it's faster as waiting for response from server.

wenn I change content of inputText, it comes no even onChange and the setter of Variable will not called.

 

Here is the code:

<script>
var gesMen;
</script>
    <script>
function calcPrice(elem){
    var path = elem.id.split(":");
    var root = elem.id.replace(path[path.length-1],"");
    gesMen = 10;
    document.getElementById(root+"anzVerp").value = gesMen;
    return null;
}

</script>

 

<apex:column headerValue="Anzahl Verpackungen">
    <apex:actionregion immediate="True">
        <apex:inputText value="{!anzVerp}"
            disabled="true" id="anzVerp">
            <apex:actionsupport event="onchange" />
            <apex:param name="Position" value="{!AP.lfdNr}" assignTo="{!applylfdNr}" />
        </apex:inputText>
    </apex:actionregion>
</apex:column>

 

Thanks

  • March 11, 2011
  • Like
  • 0

HI,

I have a problem with width of a page, I have already fixed the width of components in the page, but the width of the page is still too wide and menu(logout ...) is far right.

What could I do to fix it?

 

Tanks.

  • April 20, 2011
  • Like
  • 0

Hi.

I make some calculations in javascript, becouse it's faster as waiting for response from server.

wenn I change content of inputText, it comes no even onChange and the setter of Variable will not called.

 

Here is the code:

<script>
var gesMen;
</script>
    <script>
function calcPrice(elem){
    var path = elem.id.split(":");
    var root = elem.id.replace(path[path.length-1],"");
    gesMen = 10;
    document.getElementById(root+"anzVerp").value = gesMen;
    return null;
}

</script>

 

<apex:column headerValue="Anzahl Verpackungen">
    <apex:actionregion immediate="True">
        <apex:inputText value="{!anzVerp}"
            disabled="true" id="anzVerp">
            <apex:actionsupport event="onchange" />
            <apex:param name="Position" value="{!AP.lfdNr}" assignTo="{!applylfdNr}" />
        </apex:inputText>
    </apex:actionregion>
</apex:column>

 

Thanks

  • March 11, 2011
  • Like
  • 0