You need to sign in to do that
Don't have an account?
xyz_apu
Web service callout failed
Hi I am trying to integrate salesforce.com with Oracle Apps using BPEL. I have published my BPEL as a webservice in our test server and had created an apex class which calls this webservice. Later I am invoking this using an S-control button in Accounts tab.
But I am getting the following error when I invoke the button.
**
{faultcode:’soapenv”Client’, faultstring:’System.CalloutException: Web service callout failed: Unexpected element. Parser was expecting element ‘http://schemas.xmlsoap.org/soap/envelope/:Envelope’ but found ‘:html’
Class.wwwTrianzCom.Create_AccountPort.process: line 15, column 13
Class.AccountWrapper.CreateFunction: line 5, column 10
**
Please help me to figure out the problem.
Thank you, Aneesh
But I am getting the following error when I invoke the button.
**
{faultcode:’soapenv”Client’, faultstring:’System.CalloutException: Web service callout failed: Unexpected element. Parser was expecting element ‘http://schemas.xmlsoap.org/soap/envelope/:Envelope’ but found ‘:html’
Class.wwwTrianzCom.Create_AccountPort.process: line 15, column 13
Class.AccountWrapper.CreateFunction: line 5, column 10
**
Please help me to figure out the problem.
Thank you, Aneesh
If you are executing the webservice from within an apex class, I have used the Execute Anonymous View within the Force.com IDE to output the apex generated web service request and response.
It sounds like your response message is not being properly parsed and handled.
Hi, I'm getting the same issue, how did see the request XML message? I also used the Execute Anonymous from Force.com IDE on Eclipse but I can´t see those details? Is there any special instructions to be able to see that?
I get the "System.CalloutException: Web service callout failed: Unexpected element. Parser was expecting element 'http://schemas.xmlsoap.org/soap/envelope/:Envelope' but found ':HTML'" error message, do you know what could be wrong?
Regards,
Wilmer
Can you please post the solution if you figured out whats the issue is with.. thank you
Hi Aneesh,
Well, in fact, there should be a communication error between servers and that message doesn't help so much.
What to do? (only to see better what's going on)
1. Load the apex class that invokes the external webservice (from SFDC) in a trusted Developer Edition org, (if you want to, use the Generate from WSDL button at the apex classes list by parsing the given WSDL or just copy and paste the one you've developed in your original org).
2. Develope another apex class (NOT a Test class) that calls the class of point 1. You don't need to replicate the data model from your original org, only build the Apex objects and their attribute values the first class requires to make the callout work.
3. Run the second class using "Execute Anonymous" in your Eclipse project. Now, you should be able to see the exchanged XML message (request and response), and in this case, you'll see the HTML detail you're getting in your response.
NOTE: Don't forget to set the Remote Site location in SFDC, and try to set (if possible) the testing environment of the external webservice as your webservice endpoint.
I hope this information helps and I also would like Salesforce to activate the callout detail (possibility to see the XML format of webservice messages) in production and Sandbox org - THIS IS ONLY POSSIBLE in Developer's orgs (At least until today).
Regards,
Wilmer
Guys,
Can Any One resolve this issue
Iam calling one api (Webservice),it has returned this error
Web service callout failed: Unexpected element. Parser was expecting element 'http://schemas.xmlsoap.org/soap/envelope
Thanks in Advance
Regards
Kranthi Nagisetty
Hi,
Why don't you check the webservice availability? Did you test it from a Salesforce Developer edition? Remenber, there you could see the XML of the message (request and response).
Regards,
Wilmer
Hi,
I see the request, but no response. Its just displaying that error message.
Web service callout failed: Unexpected element. Parser was expecting element 'http://schemas.xmlsoap.org/soap/envelope/:Envelope' but found ':HTML'
Any help would be appreciated.
Thanks
Hari
I have resolved this issue -"System.CalloutException: Web service callout failed: Unexpected element. Parser was expecting element 'http://schemas.xmlsoap.org/soap/envelope/:Envelope' but found ':HTML'" -- By Correcting my end point URL in the WSDL File at SOAP address location. See below example:
For e.g -<service name="WebServiceMathService">
<documentation></documentation>
<port binding="tns:WebServiceMathBinding" name="WebServiceMath">
<soap:address location="http://techysunil-developer-edition.ap1.force.com/services/Soap/class/WebServiceMath"/>
</port>
</service>
My WSDL URL is https://ap1.salesforce.com/services/wsdl/class/WebServiceMath and i have associated my Class-WebServiceMath (enabled apex class access in Public Access Settings for Site), that contain the web service method with my site url, as mentioned in the SOAP address location.
Through this generated WSDL, i have generate the apex class [Generate from WSDL] and use that class in my Controller Class. Means, I have successfully create the apex class with web service method in one salesforce instance, and cosnume this web service method in another salesforce instance through SOAP.
Thanks
Sunil Sharma
I am doing the same SF - SF connection using SOAP/ WSDL .
I have done following things :
In my first SF org :
Created Global Class and Added method with keyword as webservice .
Created WSDL of this class
In my second SF org
Generated Class from the above WSDL .
Added instance in the remote site setting
Now from developer console I am trying to execute the webservice method like
soapSforceComSchemasClassAnkuliserv.AnkuliService consumer = new soapSforceComSchemasClassAnkuliserv.AnkuliService();
consumer.SessionHeader = new soapSforceComSchemasClassAnkuliserv.SessionHeader_element();
consumer.SessionHeader.sessionId = UserInfo.getSessionId();
String test = consumer.someMethod2('derp');
system.debug('***Test'+test);
soapSforceComSchemasClassAnkuliserv = Class generated from WSDL
AnkuliService = Inner Class
I am getting following error :
System.CalloutException: Web service callout failed: WebService returned a SOAP Fault: No service available for class 'AnkuliService' faultcode=soapenv:Client faultactor=: Class.soapSforceComSchemasClassAnkuliserv.AnkuliService.someMethod2: line 43, column 1 AnonymousBlock: line 6, column 1 AnonymousBlock: line 6, column 1
Any thoughts ?
Thanks ,
Ajay
Check for your apex class(that contains the web service method) access in Public Access Settings for Site, Enable its access.
Thanks
Sunil
Thanks for your reply .
But I am not using site for this . I have not created any site . So then how to progress ?
Thanks ,
Ajay
I'm also facing the same issue. Did you get an answer for your question?
Thanks,
Saranya
Actually I am trying to connect two salesforce org during my time.
The root cause of problem was at that time I am not adding the UserName or Password of the org where I am trying to connect.
After providing the combination I am not getting the error.
Thanks,
Ajay