小编Kev*_*Kev的帖子

将SOAP消息解组到Java /或只是解析SOAP消息?

我面对这个问题已经有一个多月了,因此,您的帮助让我感到非常满意,实际上,我在询问一种可以让我解析SOAP消息(请求)以检索所需信息的方法,例如安全信息(如果有)以及消息正文中的信息


感谢您回答我,但是知道我正在处理另一个问题,即WS-SecurityPolicy,我必须最终解析一个像这样的xml文件: <?xml version="1.0" encoding="UTF-8"?>

    <sp:TransportBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
      <wsp:Policy>
        <sp:TransportToken>
          <wsp:Policy>
            <sp:HttpsToken RequireClientCertificate="false"/>
          </wsp:Policy>
        </sp:TransportToken>
        <sp:AlgorithmSuite>
          <wsp:Policy>
            <sp:Basic128/>
          </wsp:Policy>
        </sp:AlgorithmSuite>
        <sp:Layout>
          <wsp:Policy>
            <sp:Lax/>
          </wsp:Policy>
        </sp:Layout>
        <sp:IncludeTimestamp/>
      </wsp:Policy>
    </sp:TransportBinding>
    <sp:SignedSupportingTokens xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
        <wsp:Policy>
            <sp:UsernameToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient" />
      </wsp:Policy>
    </sp:SignedSupportingTokens>
Run Code Online (Sandbox Code Playgroud)

'

知道此XML文件名为Policy.xml,并且包含必须存在的WS-SecurityPolicy规则。

java soap jaxb unmarshalling saaj

1
推荐指数
1
解决办法
2万
查看次数

任务太阳黑子中的错误:mongo:使用Mongoid在Sunspot Solr中重新编制索引

我有sunspot_mongo宝石的solr.当我尝试运行太阳黑子时:mongo:reindex我收到此错误:

reindexing House
rake aborted!
RSolr::Error::Http - 500 Internal Server Error
Error: java.io.FileNotFoundException: no segments* file found in org.apache.lucene.store.NIOFSDirectory@/home/ubuntu/Desktop/PROJECT/solr/data/development/index: files:

java.lang.RuntimeException: java.io.FileNotFoundException: no segments* file found in org.apache.lucene.store.NIOFSDirectory@/home/ubuntu/Desktop/PROJECT/solr/data/development/index: files:
at org.apache.solr.core.SolrCore.getSearcher(SolrCore.java:1068)
at org.apache.solr.update.DirectUpdateHandler2.commit(DirectUpdateHandler2.java:418)
at org.apache.solr.update.processor.RunUpdateProcessor.processCommit(RunUpdateProcessorFactory.java:85)
at org.apache.solr.handler.XMLLoader.processUpdate(XMLLoader.java:169)
at org.apache.solr.handler.XMLLoader.load(XMLLoader.java:69)
at org.apache.solr.handler.ContentStreamHandlerBase.handleRequestBody(ContentStreamHandlerBase.java:54)
at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:131)
at org.apache.solr.core.SolrCore.execute(SolrCore.java:1316)

Request Data: "<?xml version=\"1.0\" encoding=\"UTF-8\"?><commit/>"
Run Code Online (Sandbox Code Playgroud)

我已经停下来并用耙太阳黑子开始solr:solr:停止然后我得到:

java version "1.6.0_20"
OpenJDK Runtime Environment (IcedTea6 1.9.10) (6b20-1.9.10-0ubuntu1~10.10.2)
OpenJDK Client VM (build 19.0-b09, mixed mode, sharing)
Successfully stopped Solr ...
Run Code Online (Sandbox Code Playgroud)

我用命令rake sunspot启动了Solr:solr:start我得到:

java version "1.6.0_20"
OpenJDK Runtime Environment …
Run Code Online (Sandbox Code Playgroud)

solr sunspot sunspot-rails ruby-on-rails-3.1

1
推荐指数
2
解决办法
1607
查看次数

curl编译重定向页面列表

假设我有一个bash脚本,该脚本通过一个文件,该文件包含所有已重定向的旧URL列表.

curl --location http://destination.com将通过重定向来处理页面.但是,我对内容不感兴趣,而是对重定向点的位置感兴趣,以便我可以更新我的记录.

curl的命令行选项是什么,用于输出URL的新位置?

bash curl

1
推荐指数
1
解决办法
8039
查看次数

Mule ESB代理Web服务

目前,我们正在尝试使用Mule ESB构建代理,该代理提供内部Web服务,然后使用内部Web服务的提供参数转到外部soap服务.一旦我得到了,我将改变肥皂含量和布局.然后第三步结果必须由Mule计算.

但在我们到达第2步和第3步之前,先让代理开始.目前我正在查看http://www.mulesoft.org/documentation/display/MULE3USER/Proxying+Web+Services 但是提供的WSProxyService不起作用.代码似乎适用于Mule 2.2.我尝试重新创建它,看起来像这样:

<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:spring="http://www.springframework.org/schema/beans"
    xmlns:http="http://www.mulesoft.org/schema/mule/http"
    xsi:schemaLocation="
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
    http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.2/mule.xsd
    http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/3.2/mule-http.xsd">

    <spring:bean name="WSProxyService" class="org.mule.module.cxf.WSProxyService">
        <spring:property name="wsdlFile" value="resources/tisclientws.wsdl"/>
    </spring:bean>

  <flow name="HttpProxyService">
      <http:inbound-endpoint address="http://localhost:8090/tis/proxy" exchange-pattern="request-response"/>
      <component>
        <spring-object bean="WSProxyService" />
      </component>
      <http:outbound-endpoint address="ADDRESSHERE/tisclientws.asmx" exchange-pattern="request-response"/>
  </flow>
</mule>
Run Code Online (Sandbox Code Playgroud)

然而,这给出了错误

Exception stack is:
1. Service not set, this service has not been initialized properly. (org.mule.api.lifecycle.InitialisationException)
  org.mule.module.cxf.WSProxyService:254 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/lifecycle/InitialisationException.html)
Run Code Online (Sandbox Code Playgroud)

谁能帮我?我没有运气就尝试了各种各样的事情

最后但同样重要的是,我还查看了http://www.mulesoft.org/documentation/display/MULE3USER/Consuming+Web+Services+with+CXF,但问题是提供的内部服务有多个参数而没有内部WSDL .


感谢您的回复,它帮助了很多.经过一些反复试验,我得到了......有点......

目前,代理为我提供了一个本地WSDL(按预期工作).但仔细观察后,WSDL的SOAP 1.2部分保持不变,仍然指向原始位置.更糟糕的是,调用SOAP 1.1部分时会出错(原始版本工作正常).

所以我正朝着正确的方向前进.现在只是解决这些问题.

除此之外,也许有人可以指出我正确的方向.假设我想从外部服务获取输出,只计算所有小时数,然后以XML格式将其返回到本地服务.这属于自定义变压器类别吗?

我使用了以下代码:

<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core"
      xmlns:cxf="http://www.mulesoft.org/schema/mule/cxf"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" …
Run Code Online (Sandbox Code Playgroud)

esb mule

1
推荐指数
1
解决办法
4453
查看次数

Xcode问题!期待";" 方法原型之后

我刚刚开始使用Xcode,我正和一些朋友一起制作一个简单的音板应用程序.

我遇到了第一行的问题.我已经编写了代码,我很确定它是正确的,但我不明白为什么会这样!我得到了一个"预期的";' 在方法原型之后"并尝试了一切来解决它,只需插入分号就会给我带来3个错误.这是我的代码

'#import "ViewController.h"'

@interface ViewController ()

// Sound for Ben
- (IBAction)playsound1 { // this is where the error is. It is not on any other line

NSString *path = [[NSBundle mainBundle] pathForResource:@"Ben" ofType:@"mp3"];
AVAudioPlayer* theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];

theAudio.delegate=self;
[theAudio play];
}
// Sound for Bruno
- (IBAction)playsound2 {

NSString *path = [[NSBundle mainBundle] pathForResource:@"Bruno" ofType:@"mp3"];
AVAudioPlayer* theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL    fileURLWithPath:path] error:NULL];

theAudio.delegate=self;
[theAudio play];
}
// Sound for Homer
- (IBAction)playsound3 {

NSString *path = …
Run Code Online (Sandbox Code Playgroud)

xcode objective-c

1
推荐指数
1
解决办法
6945
查看次数

为什么这个事务管理器不起作用?

我第一次玩交易我以为我会得到以下代码:

namespace database
{
    class Program
    {
        static string connString = "Server=ServerName;Database=Demo;Trusted_Connection=True;";
        SqlConnection connection = new SqlConnection(connString);
        static Random r = new Random();


        static void Add()
        {
            try
            {
                Thread.Sleep(r.Next(0, 10));
                using (var trans = new TransactionScope())
                {
                    using (var conn = new SqlConnection(connString))
                    {
                        conn.Open();

                        var count = (int)new SqlCommand("select balance from bank WITH (UPDLOCK) where owner like '%Jan%'", conn).ExecuteScalar();
                        Thread.Sleep(r.Next(0, 10));
                        SqlCommand cmd = new SqlCommand("update bank set balance = " + ++count + "where owner like '%Jan%'", …
Run Code Online (Sandbox Code Playgroud)

c# sql-server transactions transactionscope

1
推荐指数
1
解决办法
4834
查看次数

通过在函数后写N个括号来调用函数N次

我想实现以下内容:

我定义了一个函数.当我在函数后写N(),函数将被调用N次.

我举个例子:

#include <iostream>
using namespace std;

typedef void* (*c)();
typedef c (*b)();
typedef b (*a)();

a aaa()
{
    cout<<"Google"<<endl;

    return (a)aaa;
}

int main()
{
    aaa()()()();
    system("pause");
}
Run Code Online (Sandbox Code Playgroud)

然后输出是:

在此输入图像描述

还有其他方法可以实现吗?

c++

1
推荐指数
1
解决办法
360
查看次数

转到C#的困难

为什么我会收到以下编译器错误:

//错误CS0159:没有这样的标签'lbl_proc_20'

使用以下代码:

//JUST A DUMMY CODE TO ILLUSTRATE THE CONCEPT
int a = resultOfFunction1();
int b = resultOfFunction2();

//10+ Local variables that are calculated depending on the results above

if (a < 10)
{
    switch (b)
    {
        case 0:
            //Actions for A<10, B=0, using local variables
            break;
        case 1:
            double c = someFunction(a, b);  //In real code involves calculations based on a and b
            if(c > 10.0)
                goto lbl_proc_20;   //error CS0159: No such label 'lbl_proc_20' within the scope of …
Run Code Online (Sandbox Code Playgroud)

c# goto

1
推荐指数
1
解决办法
4067
查看次数

基本的PowerShell功能无法正常工作

我写了这个基本的Powershell函数,它返回当前的UTC日期和时间:

Function UtcFileDate() {
    [System.DateTime]::UtcNow.ToString("yyyy-MM-ddTHH-mm-ss")
}
Run Code Online (Sandbox Code Playgroud)

但是当我运行时,翻译说:

该术语不被识别为cmdlet,函数,脚本文件或可操作程序的名称.

我在这里错过了什么?我做的 - 把这个函数放到一个单独的helpers.ps1文件,打开PowerShell控制台,导入文件.\helpers.ps1,然后调用它$x = UtcFileDate.Windows 7和Win Server 2008上都是一样的.

powershell

1
推荐指数
1
解决办法
1267
查看次数

将struct变量初始化为Nullable <int>

有没有办法在c#中将变量声明为Nullable?

struct MyStruct {        
    int _yer, _ner;

    public MyStruct() {

        _yer = Nullable<int>; //This does not work.
        _ner = 0;
    }
}
Run Code Online (Sandbox Code Playgroud)

.net c# nullable

0
推荐指数
1
解决办法
684
查看次数