获得从传统的ASP SOAP响应仅字符串 [英] get a only string from soap Response in classic asp

查看:107
本文介绍了获得从传统的ASP SOAP响应仅字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有写XML code请求的Web服务
我越来越喜欢适当的响应:

I have write xml code for requesting web service I am getting proper response like:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <getOrderFileResponse xmlns="http://www.edocbuilder.com/">
      <getOrderFileResult>**string**</getOrderFileResult>
    </getOrderFileResponse>
  </soap:Body>
</soap:Envelope>

我想从这种反应只是字符串

I want only string from this response

能否请你帮我吗?

推荐答案

我可以提供这种功能,在传统的ASP方便地提取值:

I can offer this function to easily extract the value in classic ASP:

function findStringBetween(s_string, s_pre, s_post, n_options)
  ' n_options:
  '  1: IGNORE case in the search
  dim a, b
  ' init
  findStringBetween = ""
  ' find pre-word
  a = instr(1, s_string, s_pre, n_options)
  if a>0 then
    a = a + len(s_pre)
    b = instr(a, s_string, s_post, n_options)
    if b>0 and not (s_post = "") then
      findStringBetween = mid(s_string, a, b-a)
    else
      findStringBetween = mid(s_string, a)
    end if
  end if
end function

在code加入这个,那么你可以使用这样的:

Include this in your code, then you can use it like this:

dim my_value
my_value = findStringBetween(s_soap_response, "<getOrderFileResult>", "</getOrderFileResult>", 0)

这篇关于获得从传统的ASP SOAP响应仅字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆