Link to home
Start Free TrialLog in
Avatar of SG_unique
SG_unique

asked on

How to Post XML 'response back' to Epicor b2b Supplier using Classic .ASP

I am able to receive a 'Punchout request' from supplier with no problems, but, when I try to Post response back using 'cxml-urlencoded' hidden field I receive following message:

(Tap Out message: A string variable was expected but no openning character was found)

Code is below:

Thanks for your help......

<%@LANGUAGE = VBScript%>
 
<%
'
myURL = "https://www.sg.net/SiteA/_Epicor/b2bshop.asp?CompID=0122"
'********************************************************************
 
'Build XML string
 
Function CreateCXML()
%>
<?xml version = &quot;1.0&quot; encoding=&quot;UTF-8&quot;?>
<!DOCTYPE cXML SYSTEM &quot;http://xml.cxml.org/schemas/cXML/1.2.014/cXML.dtd&quot;>
<cXML payloadID="&lt;%= Now &amp;&quot;@&quot;&amp;Request.ServerVariables(&quot;LOCAL_ADDR&quot;)%&gt;" timestamp="&lt;%= Now %&gt;">
<Response>
<Status code="200" text="Success">
</Status>
<PunchOutSetupResponse>
<StartPage>
<URL><%=myURL%>
</URL>
</StartPage>
</PunchOutSetupResponse>
</Response>
</cXML> 
<%
End Function
%>
 
<form method="post" action="<%=BrowserFormPost%>" name="ReturnPost" id="ReturnPost">
<INPUT TYPE="hidden" NAME="cxml-urlencoded" VALUE="<%=CreateCXML()%>">
</form>
 
 
<script language="javascript" type="text/javascript">
  {
    if ('<%=BrowserFormPost%>' != "")
      { 
	   document.ReturnPost.submit();
      }
  }
</script>

Open in new window

Avatar of dan_neal
dan_neal
Flag of United States of America image

Have you attempted to alert the value of the hidden field to verify that the XML is getting into the field?
If it is not try changing your function to:

Function CreateCXML()
createcxml = "<?xml version = ""1.0"" encoding=""UTF-8""?>"
createcxml = createcxml & "<!DOCTYPE cXML SYSTEM ""http://xml.cxml.org/schemas/cXML/1.2.014/cXML.dtd"">"
createcxml = createcxml & "<cXML payloadID=""" & now & "@" & Request.ServerVariables("LOCAL_ADDR") & """ timestamp=""" & Now &""">"
createcxml = createcxml & "<Response><Status code=""200"" text=""Success"" />"
createcxml = createcxml & "<PunchOutSetupResponse><StartPage>"
createcxml = createcxml & "<URL>" & myURL & "</URL></StartPage></PunchOutSetupResponse>"
createcxml = createcxml & "</Response></cXML>"
End Function

Open in new window

 Yes - XML is getting into hiddenfield ,also, tried your New function logic.
After change to program (per above function)  I initially received error: A string literal was expected.
So I replaced double-quotes with single-quotes and received error msg: The character '<' cannot be used in a attribute value.
 I decided to create a Login program to access this page and the 'hidden' field was read correctly and redirected to my catalog page w/o a problem. I'm wondering if Epicor has a configuration setting that needs to be set.

Thanks again for any suggestions
Dave
 
I am not familiar with Epicor.
ASKER CERTIFIED SOLUTION
Avatar of SG_unique
SG_unique

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial